NotificationController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 5
dl 0
loc 20
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A show() 0 3 1
A delete() 0 3 1
A unread() 0 3 1
A all() 0 3 1
1
<?php
2
3
namespace App\Http\Controllers\Frontend\User;
4
5
use App\Http\Controllers\Controller;
6
use Illuminate\Notifications\DatabaseNotification;
7
use Illuminate\Support\Carbon;
8
9
class NotificationController extends Controller
10
{
11
    public function all()
12
    {
13
        return auth()->user()->notifications;
14
    }
15
16
    public function unread()
17
    {
18
        return auth()->user()->unreadNotifications()->get();
19
    }
20
21
    public function delete(DatabaseNotification $notification)
22
    {
23
        return $notification->save(['read_at' => Carbon::now()]);
24
    }
25
26
    public function show(DatabaseNotification $notification)
27
    {
28
        return $notification;
29
    }
30
}
31