Skip to content

Conversation

People-Sea
Copy link
Contributor

Fixed: #56497

scheduling logic

Carbon::setTestNow(Carbon::create(2024, 1, 1, 8, 05, 0));
dump('Current time: '.Carbon::now()->toDateTimeString());
Schedule::days([1, 2, 3, 4, 5, 6])->group(function () {
    Schedule::between('07:00', '08:00')->group(function () {
        Schedule::call(Task1::class)->everyMinute();
        Schedule::call(Task2::class)->everyFiveMinutes();
    });

    Schedule::call(Task3::class)->at('08:05');
});

before

root@PeopleSea-PC:/laravel-bug-report# php artisan schedule:run
"Current time: 2024-01-01 08:05:00" // routes/console.php:12

   INFO  No scheduled commands are ready to run.  

after

root@PeopleSea-PC:/laravel-bug-report# php artisan schedule:run
"Current time: 2024-01-01 08:05:00" // routes/console.php:12

  2024-01-01 08:05:00 Running [App\Jobs\Task3] .......................................32.63ms DONE

Solution approach:

It is correct that attributes are inherited when group is nestedly called. However, if filters are declared in the child group, it will directly change the top-level group. Therefore, clone should be used to prevent filters from causing contamination.

Use clone to ensure group attributes are isolated and not affected by reference issues.

Fixes: laravel#56497
@taylorotwell taylorotwell merged commit 7796b9b into laravel:12.x Aug 17, 2025
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with task scheduler grouping
2 participants