FlaggedTechTipCommentNotification::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace App\Notifications;
4
5
use App\Models\TechTipComment;
6
use App\Models\User;
7
use Illuminate\Bus\Queueable;
8
use Illuminate\Contracts\Queue\ShouldQueue;
9
use Illuminate\Notifications\Messages\MailMessage;
10
use Illuminate\Notifications\Notification;
11
12
class FlaggedTechTipCommentNotification extends Notification implements ShouldQueue
13
{
14
    use Queueable;
15
16
    protected $comment;
17
    protected $user;
18
19
    /**
20
     * Create a new notification instance.
21
     *
22
     * @return void
23
     */
24
    public function __construct(TechTipComment $comment, User $user)
25
    {
26
        $this->comment = $comment;
27
        $this->user    = $user;
28
    }
29
30
    /**
31
     * Get the notification's delivery channels
32
     */
33
    public function via($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

33
    public function via(/** @scrutinizer ignore-unused */ $notifiable)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
34
    {
35
        return ['mail', 'database'];
36
    }
37
38
    /**
39
     * Get the mail representation of the notification.
40
     */
41
    public function toMail($notifiable)
42
    {
43
        return (new MailMessage)
44
                    ->subject('A Tech Tip Comment has been flagged')
45
                    ->greeting('Hello '.$notifiable->full_name)
46
                    ->line('User '.$this->user->full_name.' has flagged a comment on a Tech Tip as inappropriate.')
47
                    ->line('The comment is: ')
48
                    ->line($this->comment->comment)
49
                    ->action('Click Here to review the comment and take the appropriate action', url(route('tips.comments.index')));
50
    }
51
52
    /**
53
     * Get the array representation of the notification
54
     */
55
    public function toArray($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

55
    public function toArray(/** @scrutinizer ignore-unused */ $notifiable)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
56
    {
57
        return [
58
            'subject' => 'Tech Tip Comment Flagged as inappropriate',
59
            'data'    => [
60
                'user'    => $this->user->full_name,
61
                'comment' => $this->comment->comment,
62
            ]
63
        ];
64
    }
65
}
66