Skip to content

[12.x] Allow Scheduled Command Event macros to be applied to schedule groups#58926

Open
stevebauman wants to merge 2 commits intolaravel:12.xfrom
stevebauman:macro-command-groups
Open

[12.x] Allow Scheduled Command Event macros to be applied to schedule groups#58926
stevebauman wants to merge 2 commits intolaravel:12.xfrom
stevebauman:macro-command-groups

Conversation

@stevebauman
Copy link
Contributor

@stevebauman stevebauman commented Feb 19, 2026

This PR allows Event macros registered by third-party packages (such as Sentry, Oh Dear, etc.) to be applied to schedule groups.

Currently, built-in attributes like onOneServer() and runInBackground() work on groups, but package-level macros must be applied to each command individually:

https://docs.sentry.io/platforms/php/guides/laravel/crons/#job-monitoring

https://github.com/getsentry/sentry-laravel/blob/dbaeb9a469a92414b5d3d294c7c971a47bcab9a3/src/Sentry/Laravel/Features/ConsoleSchedulingIntegration.php#L69

$schedule
    ->onOneServer()
    ->group(function (Schedule $schedule) {
        $schedule->command('foo')->sentryMonitor();
        $schedule->command('bar')->sentryMonitor();
        $schedule->command('baz')->sentryMonitor();
    });

With this change, macros registered on Illuminate\Console\Scheduling\Event are automatically recorded and replayed onto each event in the group:

$schedule
    ->onOneServer()
    ->sentryMonitor()
    ->group(function (Schedule $schedule) {
        $schedule->command('foo');
        $schedule->command('bar');
        $schedule->command('baz');
    });

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.

1 participant

Comments