cookie("sessionKey"); $appSession = AppSession::where("session_key",$sessionKey)->first(); if(!$appSession){ return $this->redirectToLogIn(); } if(!$appSession->is_active){ return $this->redirectToLogIn(); } if ($appSession->session_type !== 'PRO') { return $this->redirectToLogIn(); } return $next($request); } private function redirectToLogIn(){ return redirect("/"); } }