EmailDbChannel::send()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 8
rs 10
1
<?php
2
3
namespace ByTIC\Notifications\Channels;
4
5
use ByTIC\Notifications\Notification;
6
7
/**
8
 * Class MailChannel
9
 * @package ByTICModels\Notifications\Channels
10
 */
11
class EmailDbChannel extends AbstractChannel
12
{
13
    /**
14
     * Send the given notification.
15
     *
16
     * @param  mixed $notifiable
17
     * @param  Notification $notification
18
     * @return int
19
     */
20
    public function send($notifiable, Notification $notification)
21
    {
22
        $email = $notification->toMailDb($notifiable);
23
        $email->save();
24
        if ($email->id > 0) {
25
            return 1;
26
        }
27
        return 0;
28
    }
29
}
30