Every SaaS ends up building the same thing: a notification settings screen where users opt in/out of email, push, Slack, etc., per category. The logic always leaks into via() arrays and policy classes scattered across the app.
I extracted this into a package: Laravel Notify Matrix.
The problem
// Before — what every Laravel app eventually does: public function via ( $notifiable ): array { $channels = [ 'database' ];
if ( $notifiable -> wantsMail ( 'orders' )) { $channels [] = 'mail' ; }
if ( $notifiable -> wantsSlack ( 'orders' ) && config ( 'app.slack_enabled' )) { $channels [] = 'slack' ; }
return $channels ; }
Enter fullscreen mode
Exit fullscreen mode
The package
// User model use Scabarcas\LaravelNotifyMatrix\Concerns\HasNotificationPreferences ;
class User extends Authenticatable { use HasNotificationPreferences ; }
// Notification class use Scabarcas\LaravelNotifyMatrix\Attributes\NotificationGroup ;
#[NotificationGroup('orders')] class OrderShipped extends Notification { public function…