diff --git a/app/Http/ViewComposers/Header.php b/app/Http/ViewComposers/Header.php index 6f523707c..5c19e1bd6 100644 --- a/app/Http/ViewComposers/Header.php +++ b/app/Http/ViewComposers/Header.php @@ -35,20 +35,22 @@ class Header ]; } - $unreads = $user->unreadNotifications; + if ($user->can('read-common-notifications')) { + $unreads = $user->unreadNotifications; - foreach ($unreads as $unread) { - $data = $unread->getAttribute('data'); + foreach ($unreads as $unread) { + $data = $unread->getAttribute('data'); - switch ($unread->getAttribute('type')) { - case 'App\Notifications\Purchase\Bill': - $bills[$data['bill_id']] = $data['amount']; - $notifications++; - break; - case 'App\Notifications\Sale\Invoice': - $invoices[$data['invoice_id']] = $data['amount']; - $notifications++; - break; + switch ($unread->getAttribute('type')) { + case 'App\Notifications\Purchase\Bill': + $bills[$data['bill_id']] = $data['amount']; + $notifications++; + break; + case 'App\Notifications\Sale\Invoice': + $invoices[$data['invoice_id']] = $data['amount']; + $notifications++; + break; + } } } diff --git a/resources/views/partials/admin/navbar.blade.php b/resources/views/partials/admin/navbar.blade.php index 64a982f77..f84c96925 100644 --- a/resources/views/partials/admin/navbar.blade.php +++ b/resources/views/partials/admin/navbar.blade.php @@ -141,62 +141,68 @@ @stack('navbar_notifications') -