$this->middleware(function($request,$next){ if (session('success')) { Alert::success(session('success')); } if (session('error')) { Alert::success(session('error')); } return $next($request); });