I have made a scheduler. When I call it with php artisan userRanking
it works.
This is the code in Kernel.php
:
protected $commands = [
\App\Console\Commands\UserRanking::class,
];
protected function schedule(Schedule $schedule)
{
$schedule->command('userRanking')
->everyMinute();
}
How do I dispatch it so that it runs automatically?
You have to set up a single cron
job that calls the schedule runner every minute:
* * * * * php /path/to/artisan schedule:run 1>> /dev/null 2>&1
Read Laravel's Scheduler docs for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With