InAppNotificationsViewComposer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 19
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A compose() 0 10 2
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\Notifications\ViewComposers;
4
5
use Auth;
6
use Hechoenlaravel\JarvisFoundation\Notifications\SendAppNotification\Notification;
7
use Illuminate\Contracts\View\View;
8
9
class InAppNotificationsViewComposer
10
{
11
    /**
12
     * Bind data to the view.
13
     *
14
     * @param  View  $view
15
     * @return void
16
     */
17
    public function compose(View $view)
18
    {
19
        if (!Auth::guest()) {
20
            $n = Notification::byUser(Auth::user())->unread()->get();
21
            $view->with('notifications', [
22
                'count' => $n->count(),
23
                'notifications' => $n
24
            ]);
25
        }
26
    }
27
}
28