A cron job is time-based job scheduler in Unix-like computer operating systems. This is normally used to schedule a job that is executed periodically or in simple word we can say when we want to execute any command automatically after some time then we perform cron job.
In laravel, we can perform cron job. The step for implementing cron job are as follow.
First we will create a file for implementing our cron job. For this the command is
php artisan command:make CommandName
that will make a file in app/commands folder.
Then we add that command in app/start/artisan.php
Artisan::add(new CommandName);
Then we write our code in CommandName file and their we mention what name we want to give our command
example
protected $name = 'karma:CommandName';
Then in server by using command
crontab -e
We will get our all cron job and by using editor nano we can give when we want to execute our command
By this way we can implement our cron job.
0 Comment(s)