@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\Invitation;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Attachment;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class InvitationMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct(public Invitation $invitation) {}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
$inviter = $this->invitation->inviterName();
|
||||
$name = $this->invitation->inviteableName();
|
||||
|
||||
return new Envelope(
|
||||
subject: $this->invitation->isForFolder()
|
||||
? __(':inviter shared the folder ":name" with you', ['inviter' => $inviter, 'name' => $name])
|
||||
: __(':inviter invited you to the ":name" workspace', ['inviter' => $inviter, 'name' => $name]),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(
|
||||
markdown: 'mail.invitation',
|
||||
with: [
|
||||
'inviterName' => $this->invitation->inviterName(),
|
||||
'inviteableName' => $this->invitation->inviteableName(),
|
||||
'roleLabel' => $this->invitation->roleLabel(),
|
||||
'isFolder' => $this->invitation->isForFolder(),
|
||||
'url' => route('invitations.accept', $this->invitation->token),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user