Answer the question
In order to leave comments, you need to log in
How to correctly implement task execution in laravel task scheduler?
Interested in the logic itself, how to organize it?
Currently, I have a task running through the created command App\Console\Commands\MyCommand
, which is called once a minute in App\Console\Kernel
:
protected function schedule(Schedule $schedule)
{
$schedule->command('mycommand:run')->everyMinute();
}
Answer the question
In order to leave comments, you need to log in
Laravel already has a great tool that you use and does a great job. No jobs are needed here. If you are confused that there is too much code in one handle method, you can simply create a layer like UserRepository and thereby make the method more readable and fault-tolerant by breaking it into small components.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question