Files
BetiX/app/Notifications/VerifyEmail.php
Dolo 0280278978
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled
Initialer Laravel Commit für BetiX
2026-04-04 18:01:50 +02:00

37 lines
1.1 KiB
PHP

<?php
namespace App\Notifications;
use Illuminate\Auth\Notifications\VerifyEmail as BaseVerifyEmail;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Cache;
class VerifyEmail extends BaseVerifyEmail
{
/**
* Build the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$verificationUrl = $this->verificationUrl($notifiable);
// Generate a 6-digit fallback verification code with same TTL as the link
$ttl = (int) Config::get('auth.verification.expire', 60);
$code = (string) random_int(100000, 999999);
Cache::put('email_verify_code:'.$notifiable->getKey(), $code, now()->addMinutes($ttl));
return (new MailMessage)
->subject('Verify Your Email Address')
->view('emails.verify-email', [
'url' => $verificationUrl,
'user' => $notifiable,
'code' => $code,
]);
}
}