PHP code example of nilanjank / scheduler-hub-laravel

1. Go to this page and download the library: Download nilanjank/scheduler-hub-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nilanjank / scheduler-hub-laravel example snippets


// routes/console.php
use Illuminate\Support\Facades\Schedule;

Schedule::command('inspire')
    ->everyMinute()
    ->description('Displays a random motivational quote.');

'enabled' => env('SCHEDULER_HUB_ENABLED', false),
'path' => env('SCHEDULER_HUB_PATH', 'scheduler-hub'),
'middleware' => ['web', 'auth'],
'ability' => env('SCHEDULER_HUB_ABILITY', 'viewSchedulerHub'),
'authorize' => null,

'manual_execution' => env('SCHEDULER_HUB_MANUAL_EXECUTION', false),
'output_limit' => env('SCHEDULER_HUB_OUTPUT_LIMIT', 12000),

'history' => [
    'enabled' => true,
    'track_scheduled_runs' => true,
    'retention_days' => 30,
    'per_page' => 25,
],

'notifications' => [
    'enabled' => false,
    'notify_on' => ['failure'],
    'channels' => [
        'mail' => ['enabled' => false, 'to' => null],
        'slack' => ['enabled' => false, 'webhook_url' => null],
        'webhook' => ['enabled' => false, 'url' => null, 'secret' => null],
    ],
],

use Illuminate\Support\Facades\Gate;

Gate::define('viewSchedulerHub', fn ($user) => $user->is_admin);

'authorize' => fn (\Illuminate\Http\Request $request) => $request->user()?->is_admin === true,

// routes/console.php
use Illuminate\Support\Facades\Schedule;

Schedule::command('scheduler-hub:prune')->daily();