65 lines
1.4 KiB
PHP
65 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Mail\Mailables\Content;
|
|
use Illuminate\Mail\Mailables\Envelope;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class VerifyAccount extends Mailable
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
/**
|
|
* Create a new message instance.
|
|
*/
|
|
public function __construct(
|
|
public User $user,
|
|
public string $verificationUrl,
|
|
) {}
|
|
|
|
/**
|
|
* Get the message envelope.
|
|
*/
|
|
public function envelope(): Envelope
|
|
{
|
|
return new Envelope(
|
|
subject: trans('mail.verify_account.subject', [], $this->mailLocale()),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get the message content definition.
|
|
*/
|
|
public function content(): Content
|
|
{
|
|
return new Content(
|
|
view: 'emails.verify-account',
|
|
with: [
|
|
'expiresInMinutes' => (int) config('auth.verification.expire', 60),
|
|
'locale' => $this->mailLocale(),
|
|
'userName' => $this->user->name,
|
|
'verificationUrl' => $this->verificationUrl,
|
|
],
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get the attachments for the message.
|
|
*
|
|
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
|
*/
|
|
public function attachments(): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
private function mailLocale(): string
|
|
{
|
|
return $this->user->preferredLocale() ?? 'en';
|
|
}
|
|
}
|