Skip to content

[12.x] Make Notification macroable#58352

Merged
taylorotwell merged 2 commits intolaravel:12.xfrom
ekateiva:feature/notification-macroable
Jan 13, 2026
Merged

[12.x] Make Notification macroable#58352
taylorotwell merged 2 commits intolaravel:12.xfrom
ekateiva:feature/notification-macroable

Conversation

@ekateiva
Copy link
Contributor

@ekateiva ekateiva commented Jan 12, 2026

Most of Laravel Facades are already macroable. Notification could also make use of macros. An example:

Notification::macro('sendToSlack', function (ChannelAwareSlackNotification $notification): void {
    Notification::route('slack', $notification::slackChannel())->notify($notification);
});

Moreover, Notification facade docblock already states that macro() method (and other related methods) exists:

* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()

So this PR also kinda fixes this "bug". (There was already a try to remove those docblocks #57727)

@taylorotwell taylorotwell merged commit 8eb9f01 into laravel:12.x Jan 13, 2026
70 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.

2 participants

Comments