Router::currentRoute PHP Method

currentRoute() public static method

Returns the route matching the current request (useful for requestAction traces)
public static currentRoute ( ) : CakeRoute
return CakeRoute Matching route object.
    public static function currentRoute()
    {
        $count = count(static::$_currentRoute) - 1;
        return $count >= 0 ? static::$_currentRoute[$count] : false;
    }

Usage Example

Exemplo n.º 1
0
 public function error500($error)
 {
     if (Router::currentRoute()->defaults['plugin'] == 'api') {
         $this->controller->viewClass = 'Json';
     }
     parent::error500($error);
 }
All Usage Examples Of Router::currentRoute