當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。