1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Thinktomorrow\Chief\App\Notifications; |
4
|
|
|
|
5
|
|
|
use Illuminate\Bus\Queueable; |
6
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue; |
7
|
|
|
use Illuminate\Notifications\Messages\MailMessage; |
8
|
|
|
use Illuminate\Notifications\Notification; |
9
|
|
|
use Illuminate\Queue\SerializesModels; |
10
|
|
|
use Thinktomorrow\Chief\Admin\Users\Invites\Invitation; |
11
|
|
|
|
12
|
|
|
class InvitationMail extends Notification implements ShouldQueue |
13
|
|
|
{ |
14
|
|
|
use Queueable; |
15
|
|
|
use SerializesModels; |
|
|
|
|
16
|
|
|
|
17
|
|
|
public $invitation; |
18
|
|
|
|
19
|
|
|
public function __construct(Invitation $invitation) |
20
|
|
|
{ |
21
|
|
|
$this->invitation = $invitation; |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @return string[] |
26
|
|
|
* |
27
|
|
|
* @psalm-return array{0: string} |
28
|
|
|
*/ |
29
|
|
|
public function via($notifiable): array |
|
|
|
|
30
|
|
|
{ |
31
|
|
|
return ['mail']; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Get the mail representation of the notification. |
36
|
|
|
* |
37
|
|
|
* @param mixed $notifiable |
38
|
|
|
* @return \Illuminate\Notifications\Messages\MailMessage |
39
|
|
|
*/ |
40
|
|
|
public function toMail($notifiable) |
|
|
|
|
41
|
|
|
{ |
42
|
|
|
return (new MailMessage()) |
43
|
|
|
->subject('Uitnodiging tot Chief') |
44
|
|
|
->from(chiefSetting('from_email', null, chiefSetting('contact_email')), chiefSetting('from_name', null, chiefSetting('contact_name'))) |
45
|
|
|
->view('chief::mails.invitation', [ |
46
|
|
|
'invitee' => $this->invitation->invitee, |
47
|
|
|
'inviter' => $this->invitation->inviter, |
48
|
|
|
'accept_url' => $this->invitation->acceptUrl(), |
49
|
|
|
'deny_url' => $this->invitation->denyUrl(), |
50
|
|
|
]); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Get the array representation of the notification. |
55
|
|
|
* |
56
|
|
|
* @param mixed $notifiable |
57
|
|
|
* @return array |
58
|
|
|
*/ |
59
|
|
|
public function toArray($notifiable) |
|
|
|
|
60
|
|
|
{ |
61
|
|
|
return [ |
62
|
|
|
// |
63
|
|
|
]; |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|