35 خطوط
1010 B
PHP
35 خطوط
1010 B
PHP
<?php
|
|
|
|
namespace App\Modules\Identity\Notifications;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class UserInvited extends Notification implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(
|
|
public readonly string $organizationName,
|
|
public readonly string $token,
|
|
) {}
|
|
|
|
public function via(object $notifiable): array
|
|
{
|
|
return ['mail'];
|
|
}
|
|
|
|
public function toMail(object $notifiable): MailMessage
|
|
{
|
|
$url = rtrim((string) config('app.frontend_url'), '/').'/accept-invitation?token='.urlencode($this->token);
|
|
|
|
return (new MailMessage)
|
|
->subject('You are invited to '.$this->organizationName)
|
|
->line('You have been invited to join '.$this->organizationName.'.')
|
|
->action('Accept invitation', $url)
|
|
->line('This invitation expires in 72 hours.');
|
|
}
|
|
}
|