Responsive Ad Area

Share This Post

test

Trying to get property ‘is_admin’ of non-object

I’m trying to build an authentication middleware for admin
but I got Trying to get property ‘is_admin’ of non-object

namespace AppHttpMiddleware;
use IlluminateSupportFacadesAuth;
use Closure;

class Admin
{
    public function handle($request, Closure $next)
{ 
    if(auth()->user()->is_admin == 1){
        return $next($request);
        }
       return redirect()->route('login');

}

and when I printed dd(auth()->user())
it returned null


Trying to get property ‘is_admin’ of non-object
Trying to get property ‘is_admin’ of non-object
test
{$excerpt:n}

Share This Post

Leave a Reply

Your email address will not be Publishedd. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Skip to toolbar