1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Notifications; |
4
|
|
|
|
5
|
|
|
use App\Models\TechTip; |
6
|
|
|
use App\Models\TechTipComment; |
7
|
|
|
use App\Models\User; |
8
|
|
|
use Illuminate\Bus\Queueable; |
9
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue; |
10
|
|
|
use Illuminate\Notifications\Messages\MailMessage; |
11
|
|
|
use Illuminate\Notifications\Notification; |
12
|
|
|
|
13
|
|
|
class EmailAdminForFlaggedComment extends Notification |
14
|
|
|
{ |
15
|
|
|
use Queueable; |
16
|
|
|
|
17
|
|
|
public $comment; |
18
|
|
|
public $techTip; |
19
|
|
|
public $flaggedBy; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Create a new notification instance. |
23
|
|
|
* |
24
|
|
|
* @return void |
25
|
|
|
*/ |
26
|
|
|
public function __construct(TechTipComment $comment, User $flaggedBy) |
27
|
|
|
{ |
28
|
|
|
$this->comment = $comment; |
29
|
|
|
$this->techTip = TechTip::find($comment->tip_id); |
30
|
|
|
$this->flaggedBy = $flaggedBy; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Get the notification's delivery channels. |
35
|
|
|
* |
36
|
|
|
* @param mixed $notifiable |
37
|
|
|
* @return array |
38
|
|
|
*/ |
39
|
|
|
public function via($notifiable) |
|
|
|
|
40
|
|
|
{ |
41
|
|
|
return ['mail']; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Get the mail representation of the notification. |
46
|
|
|
* |
47
|
|
|
* @param mixed $notifiable |
48
|
|
|
* @return \Illuminate\Notifications\Messages\MailMessage |
49
|
|
|
*/ |
50
|
|
|
public function toMail($notifiable) |
|
|
|
|
51
|
|
|
{ |
52
|
|
|
return (new MailMessage) |
53
|
|
|
->subject('A Tech Tip Comment has been flagged as inappropriate') |
54
|
|
|
->line('A comment on Tech Tip - '.$this->techTip->subject.' - has been flagged by '.$this->flaggedBy->full_name) |
55
|
|
|
->line('Comment - '.$this->comment->comment) |
56
|
|
|
->action('Click to view Tech Tip and all Comments', url(route('tech-tips.show', $this->techTip->slug))); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Get the array representation of the notification. |
61
|
|
|
* |
62
|
|
|
* @param mixed $notifiable |
63
|
|
|
* @return array |
64
|
|
|
*/ |
65
|
|
|
public function toArray($notifiable) |
|
|
|
|
66
|
|
|
{ |
67
|
|
|
return [ |
68
|
|
|
// |
69
|
|
|
]; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.