本文整理汇总了PHP中Illuminate\Routing\Router::before方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::before方法的具体用法?PHP Router::before怎么用?PHP Router::before使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\Router
的用法示例。
在下文中一共展示了Router::before方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRouter
/**
* Get the router
*
* @param array $config
*
* @return IlluminateRouter
*/
protected function getRouter($config)
{
$router = new IlluminateRouter(new Dispatcher());
$router->before(function ($request) use($router, $config) {
$customRouter = new Router($router, $config);
$customRouter->register($request);
});
return $router;
}
示例2: registerRouteFilters
/**
* Register route filters.
*
* @param \Illuminate\Routing\Router $router
*
* @return void
*/
protected function registerRouteFilters(Router $router)
{
foreach ((array) $this->before as $before) {
$router->before($before);
}
foreach ((array) $this->after as $after) {
$router->after($after);
}
foreach ((array) $this->filters as $name => $filter) {
$router->filter($name, $filter);
}
}
示例3: before
/**
* Register a new "before" filter with the router.
*
* @param string|callable $callback
* @return void
* @deprecated since version 5.1.
* @static
*/
public static function before($callback)
{
\Illuminate\Routing\Router::before($callback);
}