PHP code example of sefirosweb / laravel-cronjobs

1. Go to this page and download the library: Download sefirosweb/laravel-cronjobs 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/ */

    

sefirosweb / laravel-cronjobs example snippets


'providers' => [
        ...
    	Sefirosweb\LaravelCronjobs\LaravelCronjobsServiceProvider::class,
]

return [
    'prefix' => 'cronjobs', // Prefix path
    'middleware' => ['web', 'auth'] // Use your self auth system,
];


return [
    'prefix' => 'cronjobs',
    'middleware' => ['web', 'auth', 'checkAcl:cronjob_edit'] // Create access list "cronjob_edit" and assign to role and user
];



class EventServiceProvider extends ServiceProvider
{
    protected $listen = [
        'Sefirosweb\LaravelCronjobs\Events\DispatchCronjobSuccessfully' => [
            YourCustomListenerCronjobSuccessfully::class
            // Send: Cronjob $cronjob
        ],
        'Sefirosweb\LaravelCronjobs\Events\DispatchCronjobError' => [
            YourCustomListenerCronjobError::class
            // Send: Cronjob $cronjob, string $error
        ],
    ];


php artisan schedule:work

php artisan queue:listen

php artisan migrate

php artisan vendor:publish --provider="Sefirosweb\LaravelCronjobs\LaravelCronjobsServiceProvider" --tag=cronjobs-assets --force

php artisan vendor:publish --provider="Sefirosweb\LaravelCronjobs\LaravelCronjobsServiceProvider" --tag=config --force

php artisan cronjob:list

php artisan cronjobs:execute Foo