Skip to content

Auth Notifications ​

Unusualify\Modularous\Notifications\

Three transactional email notifications that cover the user registration and password management flows. Each class extends Laravel's Notification directly and delivers via the mail channel only.


EmailVerification ​

Unusualify\Modularous\Notifications\EmailVerification

Sent when a new user needs to verify their email address before completing registration.

Constructor ​

php
public function __construct(string $token, array $parameters = [])
ParameterTypeDescription
$tokenstringVerification token embedded in the action URL
$parametersarrayExtra route parameters merged into the verification URL

Mail content ​

FieldValue
Subject"Email Verification"
Action label"Verify Email Address"
Action URLroute('complete.register.form', [...$parameters, 'token' => $token, 'email' => $notifiable->email])
Expiry lineUses config('auth.passwords.users.expire', 60) minutes

Usage ​

php
$user->notify(new EmailVerification($token, ['invite' => $inviteId]));

Notes ​

  • The verification URL is built via Route::hasAdmin('complete.register.form'), so the route resolves through the admin route group.
  • $parameters lets callers embed extra context (e.g. an invitation ID) into the URL for retrieval after verification.

GeneratePasswordNotification ​

Unusualify\Modularous\Notifications\GeneratePasswordNotification

Sent to new users who were created without a password (e.g. admin-invited accounts). The email contains a link where the user sets their password for the first time.

Constructor ​

php
public function __construct(string $token)
ParameterTypeDescription
$tokenstringPassword-generation token

Mail content ​

FieldValue
Subject"Generate Your Password For New Account"
Action label"Generate Password"
Action URLroute('admin.register.password.generate.form', ['token' => $token, 'email' => $notifiable->getEmailForPasswordGeneration()])

Static hooks ​

Two static callbacks let you replace the URL or the full mail message without subclassing:

php
// Override the action URL
GeneratePasswordNotification::createUrlUsing(function ($notifiable, $token) {
    return route('my.custom.generate', ['token' => $token]);
});

// Override the entire MailMessage
GeneratePasswordNotification::toMailUsing(function ($notifiable, $token) {
    return (new MailMessage)->subject('Set Up Your Account')->action('Get Started', '...');
});
MethodCallback signatureEffect
createUrlUsing(callable $callback)fn($notifiable, $token): stringReplaces generatePasswordUrl()
toMailUsing(callable $callback)fn($notifiable, $token): MailMessageReplaces the entire toMail() output

Notes ​

  • The notifiable must implement getEmailForPasswordGeneration() — typically the user's email attribute.
  • The class is not queued. Wrap in a queued job if needed.

ResetPasswordNotification ​

Unusualify\Modularous\Notifications\ResetPasswordNotification

Overrides Laravel's built-in Illuminate\Auth\Notifications\ResetPassword with an app-branded mail template. The password-reset URL and token logic are inherited from the parent class.

Mail content ​

FieldValue
Subject"Reset your {app.name} password"
Greeting"Hi {user.name},"
BodyExplains the reset request and links to the reset form
Action label"Reset Password"
Expiry lineUses config('auth.passwords.{defaults.passwords}.expire')
Salutation"Regards, {app.name} Support"

Static hook ​

The parent class exposes a toMailUsing callback; this class honours it:

php
ResetPasswordNotification::toMailUsing(function ($notifiable, $token) {
    return (new MailMessage)
        ->subject('Custom Reset Subject')
        ->action('Reset Now', url('/reset/' . $token));
});

Notes ​

  • No constructor override — the token is passed by the parent's ResetPassword contract.
  • All text is wrapped in Lang::get() so translation files in resources/lang/ can override the copy.