ldc-legaulois/app/Notifications/Customer/VerifyEmail.php

61 lines
2.3 KiB
PHP
Raw Normal View History

2024-07-05 16:34:57 +02:00
<?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
{
/**
* Verify email.
2024-07-05 16:34:57 +02:00
*
* @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)),
[
2024-07-30 16:05:27 +02:00
'id' => $notifiable->getKey(),
2024-07-05 16:34:57 +02:00
'hash' => sha1($notifiable->getEmailForVerification()),
],
true
));
};
}
/**
* Build the mail representation of the notification.
*
2024-07-30 16:05:27 +02:00
* @param mixed $notifiable
2024-07-05 16:34:57 +02:00
* @return \Illuminate\Notifications\Messages\MailMessage
* @phpcs:disable Squiz.Commenting.FunctionComment.TypeHintMissing
*/
2024-07-30 16:05:27 +02:00
public function toMail(mixed $notifiable): \Illuminate\Notifications\Messages\MailMessage
2024-07-05 16:34:57 +02:00
{
// phpcs:enable
2024-07-30 16:05:27 +02:00
/** @var string $verificationUrl */
2024-07-05 16:34:57 +02:00
$verificationUrl = $this->verificationUrl($notifiable);
return (new MailMessage())
2024-07-19 12:05:37 +02:00
->template('notifications::email-club')
2024-07-05 16:34:57 +02:00
->subject(trans("Inscription - :site_name", ['site_name' => config('app.name')]))
->greeting(trans('Bonjour :name,', ['name' => $notifiable->username]))
->line(trans("Vous venez de créer un compte :strong sur le Club des Gaulois : :endStrong quelle bonne idée pour bénéficier de la Bourse aux échanges Départ'aimants et profitez des bons de réduction à imprimer !",
[
'strong' => '<strong>',
'endStrong' => '</strong>'
]
))
->line("Vous pouvez également enregistrer vos recettes favorites et les commenter et faire une liste de courses avec vos produits Le Gaulois préféré.")
->line("Pour confirmer votre inscription, merci de cliquer sur le lien ci-dessous (Lien valable 1h uniquement) :")
->action(trans('Confirmer mon adresse mail'), $verificationUrl);
2024-07-05 16:34:57 +02:00
}
}