I have a strange problem with Laravel's schedule that I am trying to solve:
ERROR: exception 'InvalidArgumentException' with message 'Invalid scheduled callback event. Must be string or callable'.
This is the line of Kernel.php:
$schedule->call(\App\Classes\Maintenance::deleteAllRecord())->daily();
And this is the function :
public static function deleteAllRecord()
{
$data=\App\LastSeen::all();
foreach ($data as $dt)
{
$dt->delete();
}
return 'OK';
}
I try also return true , but I had the same problem.I'm sure that the problem is the type of return. Where I make the mistake ? I hope I was exhaustive. I wait answer ^_^ have a good day.
You can call \App\Classes\Maintenance::deleteAllRecord() inside the callback. Like
$schedule->call(function(){
\App\Classes\Maintenance::deleteAllRecord();
})->daily();
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