PHP code example of devakshay / scheduler-list-laravel

1. Go to this page and download the library: Download devakshay/scheduler-list-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/ */

    

devakshay / scheduler-list-laravel example snippets


return [
    /*
     * The path/URL where the scheduler dashboard will be accessible.
     */
    'path' => env('SCHEDULER_LIST_PATH', 'schedulers'),

    /*
     * The middleware applied to the scheduler dashboard routes.
     * Keep auth enabled in production and add any tenant/admin/IP middleware your app needs.
     */
    'middleware' => ['web', 'auth'],

    /*
     * Optional Gate ability used by the package. The default Gate only grants access
     * in local environments; production apps should define this ability explicitly.
     */
    'ability' => env('SCHEDULER_LIST_ABILITY', 'viewSchedulerList'),

    /*
     * Optional authorization callback. Return true to allow access.
     */
    'authorize' => null,

    /*
     * Whether the scheduler dashboard is enabled.
     */
    'enabled' => env('SCHEDULER_LIST_ENABLED', false),

    /*
     * Allow developers to run scheduled tasks manually from the dashboard.
     */
    'manual_execution' => env('SCHEDULER_LIST_MANUAL_EXECUTION', false),

    /*
     * Maximum number of output characters returned to the browser after a manual run.
     */
    'output_limit' => 12000,
];

use Illuminate\Support\Facades\Gate;

Gate::define('viewSchedulerList', function ($user) {
    return $user->is_admin;
});

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

use Illuminate\Support\Facades\Schedule;

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

Schedule::call(function () {
    echo "Processing database backups...";
})->everyFiveMinutes()->description('Database Backup');
bash
php artisan serve