id; } else{ $user_id = 0; } $noti = Notification::where('user_id',$user_id)->where('status',1) ->orderBy('id','DESC')->get(); $total_noti = count($noti); $view->with('total_noti', $total_noti); if($total_noti > 0){ $view->with('noti', $noti); } else{ $noti = Notification::where('user_id',$user_id) ->orderBy('id','DESC')->take(10)->get(); $view->with('noti', $noti); } if(Auth::user()){ if(Auth::user()->utype==1){ $support_noti= Ticket::where('status','<',3)->orderBy('id','DESC')->get(); $total_support_noti=count($support_noti); $view->with('total_support_noti', $total_support_noti); if($total_support_noti > 0){ $view->with('support_noti', $support_noti); } else{ $support_noti= Ticket::where('status','<',3)->orderBy('id','DESC')->take(10)->get(); $view->with('support_noti', $support_noti); } } } } }