phplaravelcronscheduled-taskslumen

"at" function is not working from schedular from lumen


Currently i am using PHP 5.6.32 and Laravel Framework Lumen (5.4.6) (Laravel Components 5.4.*).

My problem is, when i use

$schedule->call('App\Http\Controllers\SebiController@frickSchedule',["id"=>3])->everyMinute();

It is working fine.

But when I use:

    $schedule->call('App\Http\Controllers\SebiController@frickSchedule',["id"=>3])->at("14:32");

the at function it is not working.


Solution

  • According to the documentation (https://laravel.com/docs/5.5/scheduling)

    'at' cannot be called inmediately. Because now Laravel doesn't know when to schedule exactly. (14:32 on Mondays?, Tuesdays? Fridays?)

    So if you want it to be executed daily at 14:32 use ->dailyAt('14:32')

    Otherwise you need to specify the interval more precise like ->weekly()->mondays()->at('14:32');

    In the example above 'at' can be used!