private function composeUserbar() { view()->composer('layouts.partials.userbar', function ($view) { $user = Auth::user(); $notifications = Notification::with('type')->where('user_id', Auth::id())->where('status', 'pending')->latest()->get(); $messages = Message::where('user_id', Auth::id())->where('status', 'pending')->latest()->get(); $view->with(['user' => $user, 'notifications' => $notifications, 'messages' => $messages]); }); }
public function show($id) { //show single $record = Notification::with($this->related)->findOrFail($id); return $record; }