Why not? If your schedule is dynamic, then you should call it dynamically, I think it's fine to have this logic in console.php.
Jul 24, 2025
7
Level 1
Dynamic schedule jobs
I m new to laravel 12,
I want to add dynamic job schedules, its depends on table called system in my DB
I know to add schedules in routes/console.php
but should I add below code, is it best practice to do it or there is better way to do it?
I mean is it good practice to add foreach loop or call Model System in routes/console.php file
foreach (System::forSync() as $instance) { Schedule::job(new RunSync($instance)) ->name('run_sync:'.$instance->name) ->daily() ->onOneServer() ->timezone($instance->timezone) ->withoutOverlapping(); }
Please or to participate in this conversation.