Conditions | 3 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | public function index() |
||
10 | { |
||
11 | $notifications = request()->user()->notifications() |
||
|
|||
12 | ->orderByDesc('created_at'); |
||
13 | |||
14 | $only = config('nova_notifications.only', []); |
||
15 | |||
16 | if (! empty($only)) { |
||
17 | $notifications->whereIn('type', $only); |
||
18 | } |
||
19 | |||
20 | if (request()->get('mark_as_read', false)) { |
||
21 | // Mark notifications as read |
||
22 | request()->user()->unreadNotifications->markAsRead(); |
||
23 | } |
||
24 | |||
25 | return new NotificationCollection($notifications->paginate()); |
||
26 | } |
||
28 |