sr57's avatar
Level 39

Schedule:list - description with a closure?

With this job $schedule->job(new MyJob)->daily();

php artisan schedule:list gives


|         | 0 0 * * * | App\Jobs\%yJob | 2021-08-20 00:00:00 +00:00 |

With this closure ( from the doc ) $schedule->call(function () { DB::table('recent_users')->delete(); })->daily();

php artisan schedule:list gives


|         | 0 0 * * * |                 | 2021-08-20 00:00:00 +00:00 |

Is there any solution to get a description?

0 likes
4 replies
neilstee's avatar
neilstee
Best Answer
Level 34

@sr57 not sure why it's not part of the docs but after checking the framework itself you could do it like this:

$schedule->call(function () {
	DB::table('recent_users')->delete();
})->daily()->name('My Description');

//or

$schedule->call(function () {
	DB::table('recent_users')->delete();
})->daily()->description('My Description');
1 like
sr57's avatar
Level 39

Thanks @neilstee

  • not sure why it's not part of the docs

A small omission.On the other hand the doc is excellent and this question/answer helps to settle it.

1 like

Please or to participate in this conversation.