-
Notifications
You must be signed in to change notification settings - Fork 2
/
NotificationsList.php
43 lines (36 loc) · 1007 Bytes
/
NotificationsList.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace App\Livewire;
use Illuminate\Contracts\Foundation\Application as ApplicationContract;
use Illuminate\Contracts\View\Factory;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Auth;
use Livewire\Component;
class NotificationsList extends Component
{
protected $listeners = ['refreshParentComponent' => '$refresh'];
public $unreadNotifications;
/**
* Triggered when initializing the component
* @return void
*/
public function mount()
{
$this->refreshNotifications();
}
/**
* Gets from the database eagerly the new notifications
* @return void
*/
public function refreshNotifications()
{
$this->unreadNotifications = Auth::user()->unreadNotifications;
}
/**
* Render the component
* @return Factory|Application|\Illuminate\Contracts\View\View|ApplicationContract
*/
public function render()
{
return view('livewire.notifications-list');
}
}