Passed
Push — dev5 ( 125e24...928bc2 )
by Ron
09:11
created

UserNotifications   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 18
ccs 0
cts 10
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A deleteNotification() 0 7 1
A markNotificationRead() 0 7 1
1
<?php
2
3
namespace App\Domains\Users;
4
5
use Illuminate\Support\Facades\Log;
6
use Illuminate\Support\Facades\Auth;
7
8
class UserNotifications
9
{
10
    public function markNotificationRead($id)
11
    {
12
        $notification = Auth::user()->notifications()->where('id', $id)->where('notifiable_id', Auth::user()->user_id)->first();
13
        Log::debug('Marked user notification as read for '.Auth::user()->full_name.'. Data - ', array($notification));
14
        $notification->markAsRead();
15
16
        return true;
17
    }
18
19
    public function deleteNotification($id)
20
    {
21
        $notification = Auth::user()->notifications()->where('id', $id)->where('notifiable_id', Auth::user()->user_id)->first();
22
        Log::debug('Deleted user notification for '.Auth::user()->full_name.'. Data - ', array($notification));
23
        $notification->delete();
24
25
        return true;
26
    }
27
28
}
29