NotifyNewTechTip::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
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 5
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
namespace App\Listeners\Notify;
4
5
use Illuminate\Support\Facades\Notification;
6
7
use App\Models\User;
8
use App\Events\TechTips\TechTipCreatedEvent;
9
use App\Notifications\TechTips\NewTechTipNotification;
10
use Illuminate\Contracts\Queue\ShouldQueue;
11
12
class NotifyNewTechTip implements ShouldQueue
13
{
14
    /**
15
     * Handle the event
16
     */
17
    public function handle(TechTipCreatedEvent $event)
18
    {
19
        if($event->notify)
20
        {
21
            Notification::send(User::all(), new NewTechTipNotification($event->techTip));
22
        }
23
    }
24
}
25