本文整理汇总了PHP中Illuminate\Routing\Router::pushMiddlewareToGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::pushMiddlewareToGroup方法的具体用法?PHP Router::pushMiddlewareToGroup怎么用?PHP Router::pushMiddlewareToGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\Router
的用法示例。
在下文中一共展示了Router::pushMiddlewareToGroup方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot(Router $router)
{
// load package routes
if (!$this->app->routesAreCached()) {
require __DIR__ . '/../../routes.php';
}
// make config file available if needed
$this->publishes([__DIR__ . '/../../config/liveorletdie.php' => config_path('liveorletdie.php')]);
// register package middleware
$router->pushMiddlewareToGroup('web', \PeterColes\LiveOrLetDie\Middleware\SessionTimeout::class);
}
示例2: boot
/**
* Perform post-registration booting of services.
*
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function boot(DispatcherContract $events, Router $router)
{
$router->pushMiddlewareToGroup('web', ManageSiftSession::class);
foreach ($this->listen as $event => $listeners) {
foreach ($listeners as $listener) {
$events->listen($event, $listener);
}
}
$this->loadViewsFrom(__DIR__ . '/Views', 'sift');
view()->composer('sift::snippet', SnippetComposer::class);
}
示例3: registerCmsApiGroupMiddleware
/**
* Registers global middleware for the CMS API.
*
* @return $this
*/
protected function registerCmsApiGroupMiddleware()
{
$this->router->middlewareGroup($this->getConfiguredApiGroupName(), []);
foreach ($this->getGlobalApiMiddleware() as $middleware) {
// Don't add if the middleware is already globally enabled in the kernel
if ($this->kernel->hasMiddleware($middleware)) {
continue;
}
$this->router->pushMiddlewareToGroup($this->getConfiguredApiGroupName(), $middleware);
}
return $this;
}
示例4: boot
/**
* Bootstrap the application events.
*
* @param \Illuminate\Routing\Router $router
*
* @return void
*/
public function boot(Router $router)
{
$resources = __DIR__ . '/../resources/';
$this->loadViewsFrom($resources . 'views', self::PACKAGE);
$this->loadTranslationsFrom($resources . 'lang', self::PACKAGE);
$this->publishes([$resources . 'views' => base_path('resources/views/vendor/' . self::PACKAGE)], 'views');
$this->publishes([$resources . 'lang' => base_path('resources/lang/vendor/' . self::PACKAGE)], 'lang');
$this->publishes([__DIR__ . '/../public' => public_path('vendor/' . self::PACKAGE)], 'public');
$migrationPath = __DIR__ . '/../database/migrations';
$this->publishes([$migrationPath => base_path('database/migrations')], 'migrations');
$config = $this->app['config']->get(self::PACKAGE . '.route', []);
$config['namespace'] = 'Vsch\\TranslationManager';
//$router->group($config, function ($router) {
// $router->get('view/{group}', 'Controller@getView');
// $router->controller('/', 'Controller');
//});
// Register Middleware so we can save our cached translations
$router->pushMiddlewareToGroup('web', 'Vsch\\TranslationManager\\RouteAfterMiddleware');
}
示例5: pushMiddlewareToGroup
/**
* Add a middleware to the end of a middleware group.
*
* If the middleware is already in the group, it will not be added again.
*
* @param string $group
* @param string $middleware
* @return $this
* @static
*/
public static function pushMiddlewareToGroup($group, $middleware)
{
return \Illuminate\Routing\Router::pushMiddlewareToGroup($group, $middleware);
}