1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Mail; |
4
|
|
|
|
5
|
|
|
use App\Models\Invitation; |
6
|
|
|
use Illuminate\Bus\Queueable; |
7
|
|
|
use Illuminate\Mail\Mailable; |
8
|
|
|
use Illuminate\Mail\Mailables\Content; |
9
|
|
|
use Illuminate\Mail\Mailables\Envelope; |
10
|
|
|
use Illuminate\Queue\SerializesModels; |
11
|
|
|
|
12
|
|
|
class InvitationMail extends Mailable |
13
|
|
|
{ |
14
|
|
|
use Queueable, SerializesModels; |
|
|
|
|
15
|
|
|
|
16
|
|
|
public Invitation $invitation; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Create a new message instance. |
20
|
|
|
*/ |
21
|
|
|
public function __construct(Invitation $invitation) |
22
|
|
|
{ |
23
|
|
|
$this->invitation = $invitation; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Get the message envelope. |
28
|
|
|
*/ |
29
|
|
|
public function envelope(): Envelope |
30
|
|
|
{ |
31
|
|
|
return new Envelope( |
32
|
|
|
subject: 'You\'re invited to join '.config('app.name'), |
33
|
|
|
); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Get the message content definition. |
38
|
|
|
*/ |
39
|
|
|
public function content(): Content |
40
|
|
|
{ |
41
|
|
|
return new Content( |
42
|
|
|
view: 'emails.invitation', |
43
|
|
|
with: [ |
44
|
|
|
'invitation' => $this->invitation, |
45
|
|
|
'invitedBy' => $this->invitation->invitedBy, |
46
|
|
|
'registerUrl' => route('register', ['token' => $this->invitation->token]), |
47
|
|
|
'expiresAt' => $this->invitation->expires_at, |
48
|
|
|
'siteName' => config('app.name'), |
49
|
|
|
], |
50
|
|
|
); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Get the attachments for the message. |
55
|
|
|
* |
56
|
|
|
* @return array<int, \Illuminate\Mail\Mailables\Attachment> |
57
|
|
|
*/ |
58
|
|
|
public function attachments(): array |
59
|
|
|
{ |
60
|
|
|
return []; |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|