|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Notifications; |
|
4
|
|
|
|
|
5
|
|
|
use App\Loan; |
|
6
|
|
|
use App\Mail\FirstReminderEmail; |
|
7
|
|
|
use Illuminate\Bus\Queueable; |
|
8
|
|
|
use Illuminate\Notifications\Notification; |
|
9
|
|
|
|
|
10
|
|
|
class FirstReminder extends Notification |
|
11
|
|
|
{ |
|
12
|
|
|
use Queueable; |
|
13
|
|
|
|
|
14
|
|
|
protected $subjectTpl = [ |
|
15
|
|
|
'eng' => '{thing} must be returned', |
|
16
|
|
|
'nob' => '{thing} må leveres tilbake', |
|
17
|
|
|
'nno' => '{thing} må leveres tilbake', // @TODO |
|
18
|
|
|
]; |
|
19
|
|
|
|
|
20
|
|
|
public $loan_id; |
|
21
|
|
|
public $email; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Create a new notification instance. |
|
25
|
|
|
* |
|
26
|
|
|
* @param Loan $loan |
|
27
|
|
|
*/ |
|
28
|
|
|
public function __construct(Loan $loan) |
|
29
|
|
|
{ |
|
30
|
|
|
$this->loan_id = $loan->id; |
|
31
|
|
|
$this->email = new FirstReminderEmail($loan); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Get the notification's delivery channels. |
|
36
|
|
|
* |
|
37
|
|
|
* @param mixed $notifiable |
|
38
|
|
|
* @return array |
|
39
|
|
|
*/ |
|
40
|
|
|
public function via($notifiable) |
|
|
|
|
|
|
41
|
|
|
{ |
|
42
|
|
|
return ['mail', ExtendedDatabaseChannel::class]; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Get the mail representation of the notification. |
|
47
|
|
|
* |
|
48
|
|
|
* @param mixed $notifiable |
|
49
|
|
|
* @return FirstReminderEmail |
|
50
|
|
|
*/ |
|
51
|
|
|
public function toMail($notifiable) |
|
|
|
|
|
|
52
|
|
|
{ |
|
53
|
|
|
return $this->email; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Get the array representation of the notification. |
|
58
|
|
|
* |
|
59
|
|
|
* @param mixed $notifiable |
|
60
|
|
|
* @return array |
|
61
|
|
|
*/ |
|
62
|
|
|
public function toArray($notifiable) |
|
|
|
|
|
|
63
|
|
|
{ |
|
64
|
|
|
return [ |
|
65
|
|
|
'loan_id' => $this->loan_id, |
|
66
|
|
|
'email' => $this->email->toArray(), |
|
67
|
|
|
]; |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.