本文整理匯總了PHP中Illuminate\Routing\Router::createRoute方法的典型用法代碼示例。如果您正苦於以下問題:PHP Router::createRoute方法的具體用法?PHP Router::createRoute怎麽用?PHP Router::createRoute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Routing\Router
的用法示例。
在下文中一共展示了Router::createRoute方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createRoute
/**
* Create a new route instance.
*
* @param array|string $methods
* @param string $uri
* @param mixed $action
* @return \Illuminate\Routing\Route
*/
protected function createRoute($methods, $uri, $action)
{
$route = parent::createRoute($methods, $uri, $action);
if (!empty($this->groupStack)) {
$this->mergePriority($route);
}
return $route;
}
示例2: createRoute
/**
* createRoute
*
* Additions to default routing class method createRoute.
*
* @param string $method
* @param string $pattern
* @param callable $action
*
* @return array
*/
protected function createRoute($method, $pattern, $action)
{
if (is_array($action) === true && array_key_exists('as', $action) === true) {
$alias = $action['as'];
$callback = $action['uses'];
} else {
$alias = null;
$callback = $action;
}
$this->namedRouteObjects[$pattern] = (object) ['alias' => $alias, 'method' => $method, 'callback' => $callback];
return parent::createRoute($method, $pattern, $action);
}
示例3: createRoute
/**
* Create a new route instance.
*
* @param array|string $methods
* @param string $uri
* @param mixed $action
* @return \Illuminate\Routing\Route
*/
public function createRoute($methods, $uri, $action)
{
if ($this->isApiLastGroup()) {
$uri = $this->suffix($uri);
}
return parent::createRoute($methods, $uri, $action);
}