NotificationsController::index()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Transmissor\Http\Controllers\User;
4
5
use Transmissor\Http\Controllers\User\Controller;
6
use Auth;
7
8
class NotificationsController extends Controller
9
{
10
    public function unread()
11
    {
12
        if (Auth::user()->notification_count > 0 && Auth::user()->message_count == 0) {
13
            return redirect()->route('profile.transmissor.notifications.index');
14
        }
15
        return redirect()->route('profile.transmissor.messages.index');
16
    }
17
18
    public function index(Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
19
    {
20
        $notifications = Auth::user()->notifications();
21
        Auth::user()->notification_count = 0;
22
        Auth::user()->save();
23
24
        return view('siravel::components.modules.notifications.index', compact('notifications'));
25
    }
26
27
    public function count()
28
    {
29
        return Auth::user()->notification_count + Auth::user()->message_count;
30
    }
31
}
32