Test Failed
Push — dev5 ( 1b6b88...9ca56e )
by Ron
09:04
created

MarkUserNotifications::markNotificationRead()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
namespace App\Domains\Users;
4
5
use Illuminate\Support\Facades\Auth;
6
7
class MarkUserNotifications
8
{
9
    public function markNotificationRead($id)
10
    {
11
        $notification = Auth::user()->notifications()->where('id', $id)->where('notifiable_id', Auth::user()->user_id)->first();
12
        $notification->markAsRead();
13
14
        return true;
15
    }
16
17
    public function deleteNotification($id)
18
    {
19
        $notification = Auth::user()->notifications()->where('id', $id)->where('notifiable_id', Auth::user()->user_id)->first();
20
        $notification->delete();
21
22
        return true;
23
    }
24
25
}
26