Dingo\Api\Routing\Route::isProtected PHP Method

isProtected() public method

Determine if the route is protected.
public isProtected ( ) : boolean
return boolean
    public function isProtected()
    {
        if (isset($this->middleware['api.auth']) || in_array('api.auth', $this->middleware)) {
            if ($this->controller && isset($this->middleware['api.auth'])) {
                return $this->optionsApplyToControllerMethod($this->middleware['api.auth']);
            }
            return true;
        }
        return false;
    }

Usage Example

Example #1
0
 /**
  * Indicates if a route is not protected.
  *
  * @param \Dingo\Api\Routing\Route $route
  *
  * @return bool
  */
 protected function routeNotProtected(Route $route)
 {
     return !$route->isProtected();
 }