General Rules
- Every notification delivered through the project's own notification channels must extend
App\Notifications\Notification - Never extend
Illuminate\Notifications\Notificationdirectly in those notifications - Those notifications must define:
subject()anddescription() image()is optional. The base class already resolves a sensible default, so only override it when the notification needs a different image.- Use
php artisan make:notification MyNotification(the stub already extends the base class) to create a new Notification - Do not force channels manually unless justified
- This rule applies only to actual Laravel notification classes, normally files under
app/Notificationsor classes extending Laravel/project notification base classes. - Inside
namespace App\Notifications;,extends Notificationis valid because it resolves to the localApp\Notifications\Notificationbase class. Do not require writingextends App\Notifications\Notificationor importing the class in that namespace. The same applies to sub-namespaces such asApp\Notifications\Authwhen they import the base class. - These rules cover notifications addressed to registered users through the project's inbox, mail, and web push channels. Notifications sent to someone who is not a registered user yet — such as the code that verifies a phone or email during sign-up, where the
Usermodel is still unsaved — are outside them. - The detectable signal is the delivery channel. The base class builds the mail, database, and web push payloads out of
subject(),description(), andimage(). A notification that delivers only through a dedicated channel the base class does not implement — for example a verification code sent through a customSmsChannelwith its owntoSms()— gains nothing from the base class and is outside this rule. Do not require it to extend the base class or to definesubject()anddescription().