public function middleware($name = '', $role = '', Closure $next = null)
    {
        if (!$this->accessDispatcher) {
            $this->accessDispatcher = new AccessDispatcher();
        }

        $middleware = $this->accessDispatcher->process([
            'name' => $name,
            'role' => $role,
            'next' => $next
        ]);

        if (true !== $middleware) {
            app('route.middleware.failed');
        }

        return true;
    }
public function middleware($name = '', $role = '', Closure $next = null)
    {
        if (!$this->accessDispatcher) {
            $this->accessDispatcher = new AccessDispatcher();
        }

        $middleware = $this->accessDispatcher->process([
            'name' => $name,
            'role' => $role,
            'next' => $next
        ]);

        if (true !== $middleware) {
            app('route.middleware.failed');
        }

        return true;
    }
public function middleware ( $ name = '' , $ role = '' , Closure $ next = null ) { if ( ! $ this -> accessDispatcher ) { $ this -> accessDispatcher = new AccessDispatcher ( ) ; } $ middleware = $ this -> accessDispatcher -> process ( [ 'name' => $ name , 'role' => $ role , 'next' => $ next ] ) ; if ( true !== $ middleware ) { app ( 'route.middleware.failed' ) ; } return true ; }
determine user authentication

@param string $name the middleware name
@param string|array $role the role of user, can be string or array
@param Closure $next the callback for middleware
@throws MiddlewareException
@return bool
determine user authentication