39 lines
1003 B
PHP
39 lines
1003 B
PHP
<?php
|
|
namespace App\Notifications;
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Support\Carbon;
|
|
use Illuminate\Support\Facades\URL;
|
|
|
|
class CustomEmailVerificationNotification extends Notification
|
|
{
|
|
public function __construct()
|
|
{
|
|
//
|
|
}
|
|
|
|
public function via($notifiable)
|
|
{
|
|
return ['mail'];
|
|
}
|
|
|
|
public function toMail($notifiable)
|
|
{
|
|
$verificationUrl = $this->verificationUrl($notifiable);
|
|
|
|
return (new MailMessage)
|
|
->subject('Custom Email Verification Subject')
|
|
->action('Verify Email Address', $verificationUrl);
|
|
}
|
|
|
|
protected function verificationUrl($notifiable)
|
|
{
|
|
return URL::temporarySignedRoute(
|
|
'verification.verify',
|
|
Carbon::now()->addMinutes(config('auth.verification.expire', 60)),
|
|
['id' => $notifiable->getKey(), 'hash' => sha1($notifiable->getEmailForVerification())]
|
|
);
|
|
}
|
|
}
|