本文整理汇总了PHP中Illuminate\Routing\Route::middleware方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::middleware方法的具体用法?PHP Route::middleware怎么用?PHP Route::middleware使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\Route
的用法示例。
在下文中一共展示了Route::middleware方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gatherRouteMiddlewares
/**
* Gather the middleware for the given route.
*
* @param \Illuminate\Routing\Route $route
* @return array
*/
public function gatherRouteMiddlewares(Route $route)
{
return Collection::make($route->middleware())->map(function ($name) {
return Collection::make($this->resolveMiddlewareClassName($name));
})->flatten()->all();
}
示例2: prepareMiddlewares
private function prepareMiddlewares(\Illuminate\Routing\Route $route)
{
/** @var array $middleware */
$middleware = $route->middleware();
return method_exists($route, 'controllerMiddleware') ? array_merge($middleware, $route->controllerMiddleware()) : $middleware;
}
示例3: gatherRouteMiddlewares
/**
* Gather the middleware for the given route.
*
* @param \Illuminate\Routing\Route $route
* @return array
*/
protected function gatherRouteMiddlewares(Route $route)
{
return Collection::make($route->middleware())->map(function ($m) {
return array_get($this->middleware, $m, $m);
})->all();
}
示例4: gatherRouteMiddlewares
/**
* Gather the middleware for the given route.
*
* @param \Illuminate\Routing\Route $route
* @return array
*/
public function gatherRouteMiddlewares(Route $route)
{
return Collection::make($route->middleware())->map(function ($m) {
return Collection::make(array_get($this->middleware, $m, $m));
})->collapse()->all();
}
示例5: getMiddleware
/**
* Get before filters.
*
* @param \Illuminate\Routing\Route $route
* @return string
*/
protected function getMiddleware($route)
{
$middlewares = array_values($route->middleware());
$middlewares = array_unique(array_merge($middlewares, $this->getPatternFilters($route)));
$actionName = $route->getActionName();
if (!empty($actionName) && $actionName !== 'Closure') {
$middlewares = array_merge($middlewares, $this->getControllerMiddleware($actionName));
}
return implode(',', $middlewares);
}
示例6: getMiddleware
/**
* Get before filters
*
* @param \Illuminate\Routing\Route $route
* @return string
*/
protected function getMiddleware($route)
{
$middleware = array_values($route->middleware());
$middleware = array_unique(array_merge($middleware, $this->getPatternFilters($route)));
return implode(', ', $middleware);
}
示例7: getMiddleware
/**
* Get middleware
*
* @param \Illuminate\Routing\Route $route
* @return string
*/
protected function getMiddleware($route)
{
$middleware = array_keys($route->middleware());
return implode(', ', $middleware);
}
示例8: gatherRouteMiddlewares
/**
* Gather the middleware for the given route.
*
* @param \Illuminate\Routing\Route $route
* @return array
*/
public function gatherRouteMiddlewares(Route $route)
{
$result = [];
foreach ($route->middleware() as $tag) {
$result[] = isset($this->middleware[$tag]) === true ? $this->middleware[$tag] : $tag;
}
return $result;
}