当前位置: 首页>>代码示例>>PHP>>正文


PHP Router::pushMiddlewareToGroup方法代码示例

本文整理汇总了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);
 }
开发者ID:petercoles,项目名称:live-or-let-die,代码行数:16,代码来源:LiveOrLetDieServiceProvider.php

示例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);
 }
开发者ID:suth,项目名称:laravel-sift,代码行数:18,代码来源:SiftServiceProvider.php

示例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;
 }
开发者ID:czim,项目名称:laravel-cms-core,代码行数:17,代码来源:MiddlewareServiceProvider.php

示例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');
 }
开发者ID:vsch,项目名称:laravel-translation-manager,代码行数:26,代码来源:ManagerServiceProvider.php

示例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);
 }
开发者ID:blargent,项目名称:pimplot,代码行数:14,代码来源:_ide_helper.php


注:本文中的Illuminate\Routing\Router::pushMiddlewareToGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。