ldc-legaulois/app/Notifications/Customer/VerifyEmail.php
2024-07-19 12:05:37 +02:00

60 lines
2 KiB
PHP

<?php
namespace App\Notifications\Customer;
use Illuminate\Auth\Notifications\VerifyEmail as NotificationsVerifyEmail;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\URL;
class VerifyEmail extends NotificationsVerifyEmail
{
/**
* VerifyEmail
*
* @return void
*/
public function __construct()
{
static::$createUrlCallback = function ($notifiable) {
return \url(URL::temporarySignedRoute(
'club.verification.verify',
Carbon::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 \Illuminate\Notifications\Messages\MailMessage
* @phpcs:disable Squiz.Commenting.FunctionComment.TypeHintMissing
*/
public function toMail($notifiable)
{
// phpcs:enable
/** @var \App\Models\Customer $notifiable */
$verificationUrl = $this->verificationUrl($notifiable);
$firstname = $notifiable->username;
return (new MailMessage())
->template('notifications::email-club')
->subject(trans("Inscription - :site_name", ['site_name' => config('app.name')]))
/** @var string $firstname */
->greeting(trans('Bonjour :name', ['name' => $firstname]))
->line(trans(
"Vous venez de créer un compte sur :site_name.",
['site_name' => config('app.name')]
))
->line("Pour confirmer votre inscription, merci de cliquer sur le lien ci-dessous :")
/** @var string $verificationUrl */
->action(trans('Confirmer mon adresse email'), $verificationUrl);
}
}