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

MarkUserNotifications   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A markNotificationRead() 0 6 1
A deleteNotification() 0 6 1
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