diff --git a/app/Http/Controllers/NotificationController.php b/app/Http/Controllers/NotificationController.php index d1184eb..9430f8a 100644 --- a/app/Http/Controllers/NotificationController.php +++ b/app/Http/Controllers/NotificationController.php @@ -9,7 +9,7 @@ class NotificationController extends Controller { public function index() { - $notifications = auth()->user()->profile->cabang->notifications; + $notifications = auth()->user()->profile->cabang ? auth()->user()->profile->cabang->notifications : []; Notification::where('to', auth()->user()->profile->cabang->id)->update(['is_read' => true]); return view('notification.index', compact('notifications')); }