本文整理匯總了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;
}