本文整理匯總了PHP中Laravel\Bundle::routes方法的典型用法代碼示例。如果您正苦於以下問題:PHP Bundle::routes方法的具體用法?PHP Bundle::routes怎麽用?PHP Bundle::routes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Laravel\Bundle
的用法示例。
在下文中一共展示了Bundle::routes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: uses
/**
* Find the route that uses the given action.
*
* @param string $action
* @return array
*/
public static function uses($action)
{
// If the action has already been reverse routed before, we'll just
// grab the previously found route to save time. They are cached
// in a static array on the class.
if (isset(static::$uses[$action])) {
return static::$uses[$action];
}
Bundle::routes(Bundle::name($action));
// To find the route, we'll simply spin through the routes looking
// for a route with a "uses" key matching the action, and if we
// find one, we cache and return it.
foreach (static::routes() as $method => $routes) {
foreach ($routes as $key => $value) {
if (isset($value['uses']) and $value['uses'] === $action) {
return static::$uses[$action] = array($key => $value);
}
}
}
}
示例2: uses
public static function uses($action)
{
if (isset(static::$uses[$action])) {
return static::$uses[$action];
}
Bundle::routes(Bundle::name($action));
foreach (static::routes() as $method => $routes) {
foreach ($routes as $key => $value) {
if (isset($value['uses']) and $value['uses'] === $action) {
return static::$uses[$action] = array($key => $value);
}
}
}
}