本文整理汇总了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);
}
}
}
}