Please Like and subscribe:
How to setup CRON in laravel 5?
Easy way to setup a CRON in laravel 5.
please folow these steps to set up cron/scheduler
1 – goto terminal/cmd and type the following command
php artisan make:console emailuser
2 – Now goto your project directory following path
app/console/Commands you will see the new class has been created with your given name.
3- Now goto the following path
and add the following command into the $command array.
4 – now add your signature in the schedule array in kernel.php
Signature: signature is use to run your command.
5 – now goto the terminal/cmd and run the php artisan command to check if your command is registered or not.
as you can see our command signature email:user is registered
it means we can run the command.
6 – Now goto your command class app/Console/Commands/emailUser.php
and put some piece of code in the handle function
handle: handle is responsible for taking the request and perform the action, whatever you will write in this function it will call when our email:user command will run.
so, for the testing purpose just echo some text inside the function.
Our Scheduler is set up now, to test just goto your terminal/cmd and write your command name with php artisan
i.e php artisan email:user, now let’s see in action.
if. you are seeing the output
My Cron is running…
which we have added in the handle action, then
you are done here 🙂
Thanks! for watching…
like and subscribe.
next lesson we will learn how to setup cron from the server in laravel 5.2
PHP,Laravel PHP Framework,How To,MVC,laravel cron job command,laravel cron job tutorial,laravel cronjob,laravel 5 scheduler,laravel task scheduler,laravel 5 cron job tutorial,laravel 5 scheduler example,laravel 5 scheduler tutorial