57 lines
1.5 KiB
PHP
57 lines
1.5 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Mail;
|
||
|
|
|
||
|
|
use App\Models\TeamInvitation;
|
||
|
|
use App\Models\Workspace;
|
||
|
|
use Illuminate\Bus\Queueable;
|
||
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||
|
|
use Illuminate\Mail\Mailable;
|
||
|
|
use Illuminate\Mail\Mailables\Content;
|
||
|
|
use Illuminate\Mail\Mailables\Envelope;
|
||
|
|
use Illuminate\Queue\SerializesModels;
|
||
|
|
|
||
|
|
class TeamInvitationMail extends Mailable implements ShouldQueue
|
||
|
|
{
|
||
|
|
use Queueable, SerializesModels;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Create a new message instance.
|
||
|
|
*/
|
||
|
|
public function __construct(
|
||
|
|
public Workspace $workspace,
|
||
|
|
public TeamInvitation $invitation
|
||
|
|
) {}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the message envelope.
|
||
|
|
*/
|
||
|
|
public function envelope(): Envelope
|
||
|
|
{
|
||
|
|
return new Envelope(
|
||
|
|
subject: 'Invitation à rejoindre '.$this->workspace->name,
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the message content definition.
|
||
|
|
*/
|
||
|
|
public function content(): Content
|
||
|
|
{
|
||
|
|
$roleLabels = [
|
||
|
|
'manager' => 'Gestionnaire',
|
||
|
|
'worker' => 'Collaborateur',
|
||
|
|
];
|
||
|
|
|
||
|
|
return new Content(
|
||
|
|
markdown: 'emails.team-invitation',
|
||
|
|
with: [
|
||
|
|
'workspaceName' => $this->workspace->name,
|
||
|
|
'roleLabel' => $roleLabels[$this->invitation->role] ?? $this->invitation->role,
|
||
|
|
'registerUrl' => route('register', ['invitation' => $this->invitation->token]),
|
||
|
|
'expiresAt' => $this->invitation->expires_at->format('d/m/Y à H:i'),
|
||
|
|
]
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|