Generate Class.
php artisan command:make FooCommand
php artisan command:make [[your command]]
This command will generate a class in app/commands.
Write Your Function
Write your functions in your generated command fire() method.
Register Command
Write: Artisan::add(new [[your command]]);
In app/start/artisan.php
Runs Cron Job
Write in terminal : crontab -e
Write:
* * * * * php [[path to application]]/[[your application]]/artisan background:process
* * * * * : it means this cron job will be executed every minutes
Great notes, simple and clear.
ReplyDeleteThank You !