Files
Verde-Web/app/Notifications/VerifyEmailNotification.php

42 lines
1.4 KiB
PHP

<?php
namespace App\Notifications;
use Illuminate\Auth\Notifications\VerifyEmail as BaseVerifyEmail;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\URL;
/**
* Customizes the default Laravel verification mail with Verde branding.
* The signed URL it generates is consumed by VerifyEmailController.
*
* We override `verificationUrl()` because our route lives under the
* `api.v1.auth.` name prefix, so the default `verification.verify`
* lookup wouldn't resolve.
*/
class VerifyEmailNotification extends BaseVerifyEmail
{
protected function verificationUrl($notifiable): string
{
return URL::temporarySignedRoute(
'api.v1.auth.verification.verify',
Carbon::now()->addMinutes((int) config('auth.verification.expire', 60)),
[
'id' => $notifiable->getKey(),
'hash' => sha1($notifiable->getEmailForVerification()),
],
);
}
protected function buildMailMessage($url): MailMessage
{
return (new MailMessage)
->subject('Verify your Verde email')
->greeting('Hello,')
->line('Tap the button below to confirm your Verde account email address.')
->action('Verify email', $url)
->line('If you did not create an account, no further action is required.');
}
}