ldc-gen-game-web/app/Notifications/Customer/VerifyEmail.php
2026-10-20 12:27:49 +02:00

70 lines
2.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Notifications\Customer;
use App\Models\Settings;
use Closure;
use Illuminate\Auth\Notifications\VerifyEmail as NotificationsVerifyEmail;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\URL;
class VerifyEmail extends NotificationsVerifyEmail
{
/**
* The callback that should be used to create the reset password URL.
*
* @var Closure|null
*/
#[\Override]
public static $createUrlCallback;
/**
* VerifyEmail
*/
public function __construct()
{
static::$createUrlCallback = (fn ($notifiable) => \url(URL::temporarySignedRoute(
'fo.verification.verify',
Date::now()->addMinutes(Config::get('auth.verification.expire', 60)),
[
'id' => $notifiable->getKey(),
'hash' => sha1($notifiable->getEmailForVerification()),
],
true
)));
}
/**
* Build the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
* @phpcs:disable Squiz.Commenting.FunctionComment.TypeHintMissing
*/
public function toMail($notifiable)
{
// phpcs:enable
/** @var Settings */
$settings = resolve(Settings::class);
/** @var \App\Models\Customer $notifiable */
/** @var string $verificationUrl */
$verificationUrl = $this->verificationUrl($notifiable);
/** @var string $first_name */
$first_name = $notifiable->api_data->firstname;
return new MailMessage()
->success()
->subject(trans('front.mails.subjects.verify_email', ['site_name' => $settings->name]))
->greeting(trans('front.mails.greetings.with_name', ['first_name' => $first_name]))
->line(trans('front.mails.contents.verify_email_1'))
->line(trans('front.mails.contents.verify_email_2'))
->action(trans('front.mails.actions.verify_email'), $verificationUrl)
->line(trans('front.mails.contents.verify_email_3'));
}
}