NotifyAddedCustomerFile   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 4
c 1
b 0
f 0
dl 0
loc 11
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 6 1
1
<?php
2
3
namespace App\Listeners\Notify\Customers;
4
5
use App\Models\User;
6
use App\Models\UserCustomerBookmark;
7
use App\Notifications\Customers\NewFileNotification;
8
use App\Events\Customers\Files\CustomerFileAddedEvent;
9
10
use Illuminate\Contracts\Queue\ShouldQueue;
11
use Illuminate\Support\Facades\Notification;
12
13
class NotifyAddedCustomerFile implements ShouldQueue
14
{
15
    /**
16
     * Handle the event
17
     */
18
    public function handle(CustomerFileAddedEvent $event)
19
    {
20
        $bookmarks = UserCustomerBookmark::where('cust_id', $event->cust->cust_id)->get()->pluck('user_id')->toArray();
21
        $userList  = User::find($bookmarks);
22
23
        Notification::send($userList, new NewFileNotification($event->cust));
24
    }
25
}
26