/** * Bind data to the view. * * @param View $view * @return void */ public function compose(View $view) { if (!Auth::guest()) { $n = Notification::byUser(Auth::user())->unread()->get(); $view->with('notifications', ['count' => $n->count(), 'notifications' => $n]); } }
/** * Lists notifications * @return $this */ public function index() { $notifications = Notification::byUser(Auth::user())->orderBy('created_at', 'DESC')->paginate(20); return view('jarvisPlatform::notifications.index')->with('notifications', $notifications); }