NotificationViewComposer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace Modules\Notification\Composers;
4
5
use Illuminate\Contracts\View\View;
6
use Modules\Notification\Repositories\NotificationRepository;
7
use Modules\User\Contracts\Authentication;
8
9
class NotificationViewComposer
10
{
11
    /**
12
     * @var NotificationRepository
13
     */
14
    private $notification;
15
    /**
16
     * @var Authentication
17
     */
18
    private $auth;
19
20
    public function __construct(NotificationRepository $notification, Authentication $auth)
21
    {
22
        $this->notification = $notification;
23
        $this->auth = $auth;
24
    }
25
26
    public function compose(View $view)
27
    {
28
        $notifications = $this->notification->latestForUser($this->auth->id());
29
        $view->with('notifications', $notifications);
30
    }
31
}
32