NotificationController::unread()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
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