ExtendedDatabaseChannel   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A buildPayload() 0 11 1
1
<?php
2
3
namespace App\Notifications;
4
5
use Illuminate\Notifications\Channels\DatabaseChannel;
6
use Illuminate\Notifications\Notification;
7
use Illuminate\Support\Arr;
8
9
class ExtendedDatabaseChannel extends DatabaseChannel
10
{
11
    /**
12
     * Build an array payload for the DatabaseNotification Model.
13
     *
14
     * @param  mixed  $notifiable
15
     * @param  \Illuminate\Notifications\Notification  $notification
16
     * @return array
17
     */
18
    protected function buildPayload($notifiable, Notification $notification)
19
    {
20
        $data = $this->getData($notifiable, $notification);
21
        return [
22
            'id' => $notification->id,
23
            'type' => get_class($notification),
24
            'read_at' => null,
25
26
            'loan_id' => Arr::get($data, 'loan_id'),
27
            'data' => [
28
                'email' => Arr::get($data, 'email'),
29
            ],
30
        ];
31
    }
32
}
33