kennyS
3 years ago
2524
12
Laravel

current user in middleware

Posted 3 years ago by kennyS

Hi,

I want to get my current user data in a middleware

 public function handle($request, Closure $next)
    {
       
        if($request->user()->id == "1")
        {
            return $next($request);
       } 
         return redirect('/');
}

and also Auth don't work? i go always to "/"

Please sign in or create an account to participate in this conversation.