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


PHP Router::middleware方法代码示例

本文整理汇总了PHP中Illuminate\Routing\Router::middleware方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::middleware方法的具体用法?PHP Router::middleware怎么用?PHP Router::middleware使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Routing\Router的用法示例。


在下文中一共展示了Router::middleware方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: boot

 /**
  * Register routes, translations, views and publishers.
  *
  * @return void
  */
 public function boot(\Illuminate\Routing\Router $router)
 {
     Config::set('auth.model', 'Askedio\\Laravelcp\\Models\\User');
     Config::set('auth.password.email', 'lcp::emails.password');
     $router->middleware('auth', 'Askedio\\Laravelcp\\Http\\Middleware\\Authenticate');
     $router->middleware('auth.basic', 'Illuminate\\Auth\\Middleware\\AuthenticateWithBasicAuth');
     $router->middleware('guest', 'Askedio\\Laravelcp\\Http\\Middleware\\RedirectIfAuthenticated');
     $router->middleware('role', 'Askedio\\Laravelcp\\Http\\Middleware\\VerifyRole');
     $router->middleware('permission', 'Askedio\\Laravelcp\\Http\\Middleware\\VerifyPermission');
     $loader = \Illuminate\Foundation\AliasLoader::getInstance();
     $loader->alias('Nav', 'Askedio\\Laravelcp\\Helpers\\NavigationHelper');
     $loader->alias('Hook', 'Askedio\\Laravelcp\\Helpers\\HookHelper');
     $loader->alias('Search', 'Askedio\\Laravelcp\\Helpers\\SearchHelper');
     NavigationHelper::Initialize();
     HookHelper::Initialize();
     SearchHelper::Initialize();
     if (!$this->app->routesAreCached()) {
         require realpath(__DIR__ . '/../Http/routes.php');
     }
     $this->loadTranslationsFrom(realpath(__DIR__ . '/../Resources/Lang'), 'lcp');
     $this->loadViewsFrom(realpath(__DIR__ . '/../Resources/Views'), 'lcp');
     NavigationHelper::Add(['nav' => 'main', 'sort' => '0', 'link' => url('/dashboard'), 'title' => trans('lcp::nav.dashboard'), 'icon' => 'fa-dashboard']);
     $this->publishes([realpath(__DIR__ . '/../Resources/Views') => base_path('resources/views/vendor/askedio/laravelcp')], 'views');
     $this->publishes([realpath(__DIR__ . '/../Resources/Assets') => public_path('assets')], 'public');
     $this->publishes([realpath(__DIR__ . '/../Resources/Config') => config_path('')], 'config');
     $this->publishes([realpath(__DIR__ . '/../Database/Migrations') => database_path('migrations')], 'migrations');
     $this->publishes([realpath(__DIR__ . '/../Database/Seeds') => database_path('seeds')], 'seeds');
 }
开发者ID:askedio,项目名称:laravelcp,代码行数:33,代码来源:LaravelcpServiceProvider.php

示例2: boot

 /**
  * Perform post-registration booting of services.
  *
  * @return void
  */
 public function boot(Router $router)
 {
     $router->middleware('roles', \App\Http\Middleware\HasRole::class);
     $router->middleware('admin', \App\Http\Middleware\AdminMiddleware::class);
     if (!$this->app->routesAreCached()) {
         require __DIR__ . '/Http/routes.php';
     }
     $configFiles = ['acl'];
     foreach ($configFiles as $config) {
         $this->mergeConfigFrom(__DIR__ . "/config/{$config}.php", 'acl');
     }
     $this->loadTranslationsFrom(__DIR__ . '/resources/lang', 'acl');
     $this->loadViewsFrom(__DIR__ . '/resources/views', 'acl');
     //Publish middleware
     $this->publishes([__DIR__ . '/Middleware/' => app_path('Http/Middleware')]);
     //Publish providers
     $this->publishes([__DIR__ . '/Providers/' => app_path('Providers')]);
     //Publish views
     $this->publishes([__DIR__ . '/resources/views' => resource_path('views')], 'views');
     //Publish translations
     $this->publishes([__DIR__ . '/resources/lang/' => resource_path('lang/')], 'translations');
     // Publish a config file
     $this->publishes([__DIR__ . '/config/acl.php' => config_path('acl.php')], 'config');
     //Publish migrations
     $this->publishes([__DIR__ . '/database/migrations' => database_path('migrations'), __DIR__ . '/database/seeds' => database_path('seeds')], 'migrations');
     $this->publishes([__DIR__ . '/assets/bower_components/AdminLTE/' => public_path('/assets/bower_components/AdminLTE/')], 'public');
     $this->publishes([__DIR__ . '/Http/Controllers/Auth/' => app_path('/Http/Controllers/Auth/'), __DIR__ . '/Http/Controllers/Admin/' => app_path('/Http/Controllers/Admin/')], 'controllers');
     $this->publishes([__DIR__ . '/Models/Admin/' => app_path()], 'models');
 }
开发者ID:meccado,项目名称:acl-admin-control-panel,代码行数:34,代码来源:AclAdminControlPanelServiceProvider.php

示例3: boot

 /**
  * @param Router $router
  */
 public function boot(Router $router)
 {
     $router->middleware(HalApiETagMiddleware::NAME, HalApiETagMiddleware::class);
     $router->middleware(HalApiCacheMiddleware::NAME, HalApiCacheMiddleware::class);
     $this->app->singleton(RouteHelper::class, function () use($router) {
         return new RouteHelper($router);
     });
 }
开发者ID:jarischaefer,项目名称:hal-api,代码行数:11,代码来源:HalApiServiceProvider.php

示例4: registerMiddleware

 /**
  * Register all the Flare Provided Middleware and Middleware Groups.
  *
  * We define flarebase rather than extend an existing middleware stack
  * since it is possible that a user has amended the default middleware 
  * of their application in a way that could break Flare.
  * 
  * @param Router $router
  */
 protected function registerMiddleware(Router $router)
 {
     $router->middleware('flareauthenticate', \LaravelFlare\Flare\Http\Middleware\FlareAuthenticate::class);
     $router->middleware('checkmodelfound', \LaravelFlare\Flare\Http\Middleware\CheckModelFound::class);
     $router->middleware('checkpermissions', \LaravelFlare\Flare\Http\Middleware\CheckPermissions::class);
     $router->middlewareGroup('flarebase', [\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \App\Http\Middleware\EncryptCookies::class]);
     $router->middlewareGroup('flare', ['web', 'flarebase', 'flareauthenticate', 'checkpermissions']);
 }
开发者ID:laravelflare,项目名称:flare,代码行数:17,代码来源:RouteServiceProvider.php

示例5: boot

 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot(Router $router)
 {
     include_once __DIR__ . '/Http/routes.php';
     $this->loadViewsFrom(__DIR__ . '/views', 'lui');
     $this->publishes([__DIR__ . '/database/migrations/2016_08_01_000001_create_demo_table.php' => base_path('database/migrations/2016_08_01_000000_create_demo_table.php')]);
     $router->middleware('luiAuth', \Luivel\Lui\Http\Middleware\luiAuth::class);
     $router->middleware('luiGuest', \Luivel\Lui\Http\Middleware\luiGuest::class);
 }
开发者ID:luivel,项目名称:lui,代码行数:13,代码来源:LuiServiceProvider.php

示例6: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->middleware('oauth', 'LucaDegasperi\\OAuth2Server\\Middleware\\OAuthMiddleware');
     $router->middleware('oauth-user', 'Ruysu\\Core\\Http\\Middleware\\OAuthUser');
     $router->middleware('oauth-owner', 'LucaDegasperi\\OAuth2Server\\Middleware\\OAuthOwnerMiddleware');
     $router->middleware('check-authorization-params', 'LucaDegasperi\\OAuth2Server\\Middleware\\CheckAuthCodeRequestMiddleware');
     parent::boot($router);
 }
开发者ID:ruysu,项目名称:laravel-core,代码行数:14,代码来源:RouteServiceProvider.php

示例7: boot

 /**
  * Bootstrap the application events.
  *
  * @param Router $router
  */
 public function boot(Router $router)
 {
     $router->middleware('maintenance.not-auth', NotAuthMiddleware::class);
     $router->middleware('maintenance.auth', AuthMiddleware::class);
     $router->middleware('maintenance.permission', PermissionMiddleware::class);
     $this->bootPublishable();
     $this->bootLoadable();
     $this->bootRequiredFiles();
 }
开发者ID:redknitin,项目名称:maintenance,代码行数:14,代码来源:MaintenanceServiceProvider.php

示例8: boot

 /**
  * Define your module's route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router $router
  * @return void
  */
 public function boot(Router $router)
 {
     $this->initAssets();
     $router->middleware('authenticate', \App\Modules\VergoBase\Http\Middleware\Authenticate::class);
     $router->middleware('AdminAuth', \App\Modules\VergoBase\Http\Middleware\AdminAuth::class);
     $router->middleware('AdminAuthenticate', \App\Modules\VergoBase\Http\Middleware\AdminAuthenticate::class);
     $router->middlewareGroup('webAdmin', [\App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class]);
     parent::boot($router);
 }
开发者ID:Golars,项目名称:Naissance_Laravel,代码行数:15,代码来源:RouteServiceProvider.php

示例9: boot

 public function boot(Router $router)
 {
     // Register Middleware
     $router->middleware('spamguard', Middleware\SpamGuard::class);
     $router->middleware('spam_honeypot', Middleware\SpamHoneypot::class);
     $router->middleware('spam_timer', Middleware\SpamTimer::class);
     $router->middleware('spam_recaptcha', Middleware\SpamRecaptcha::class);
     $this->publishes([__DIR__ . '/../../config/spamguard.php' => config_path('spamguard.php')], 'config');
 }
开发者ID:ryanwinchester,项目名称:laravel-spamguard,代码行数:9,代码来源:SpamGuardServiceProvider.php

示例10: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router $router
  *
  * @return void
  */
 public function boot(Router $router)
 {
     $router->middleware('soda.main', Cms::class);
     $router->middleware('soda.auth', Authenticate::class);
     $router->middleware('role', EntrustRole::class);
     $router->middleware('permission', EntrustPermission::class);
     $router->middleware('ability', EntrustAbility::class);
     parent::boot($router);
 }
开发者ID:sodacms,项目名称:sodacms,代码行数:16,代码来源:RouteServiceProvider.php

示例11: setupRoutes

 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router $router
  * @return void
  */
 public function setupRoutes(Router $router)
 {
     // routes
     if (!$this->app->routesAreCached()) {
         require __DIR__ . '/Http/routes.php';
     }
     // middleware
     $router->middleware('guest_user', 'Ax2to\\LaravelUser\\Http\\Middleware\\RedirectIfAuthenticated');
     $router->middleware('auth_user', 'Ax2to\\LaravelUser\\Http\\Middleware\\Authenticate');
 }
开发者ID:ax2to,项目名称:laravel-user,代码行数:16,代码来源:LaravelUserServiceProvider.php

示例12: boot

 /**
  * Register routes, translations, views and publishers.
  *
  * @return void
  */
 public function boot(Router $router)
 {
     $this->loadTranslationsFrom(__DIR__ . '/../lang', 'jsonapi');
     $this->publishes([__DIR__ . '/../lang' => resource_path('lang/vendor/jsonapi'), __DIR__ . '/../config/jsonapi.php' => config_path('jsonapi.php')]);
     $router->middleware('jsonapi', \Askedio\Laravel5ApiController\Http\Middleware\JsonApiMiddleware::class);
     $router->middleware('jsonapi.auth.basic', \Askedio\Laravel5ApiController\Http\Middleware\Auth\JsonApiAuthBasicMiddleware::class);
     response()->macro('jsonapi', function ($code, $value) {
         $apiResponse = new \Askedio\Laravel5ApiController\Http\Responses\ApiResponse();
         return $apiResponse->jsonapi($code, $value);
     });
 }
开发者ID:askedio,项目名称:laravel-cruddy,代码行数:16,代码来源:GenericServiceProvider.php

示例13: boot

 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->router->middleware('anavel.auth', Authenticate::class);
     include __DIR__ . '/Http/routes.php';
     $this->loadViewsFrom(__DIR__ . '/../views', 'anavel');
     $this->loadTranslationsFrom(__DIR__ . '/../lang', 'anavel');
     $this->publishes([__DIR__ . '/../config/anavel.php' => config_path('anavel.php')], 'config');
     $this->publishes([__DIR__ . '/../public/bootstrap' => public_path('vendor/anavel/bootstrap'), __DIR__ . '/../public/dist' => public_path('vendor/anavel/dist'), __DIR__ . '/../public/plugins' => public_path('vendor/anavel/plugins')], 'assets');
     $anavel = $this->app->make('Anavel\\Foundation\\Contracts\\Anavel');
     $anavel->boot();
 }
开发者ID:anavel,项目名称:foundation,代码行数:16,代码来源:AnavelServiceProvider.php

示例14: boot

 /**
  * Register the service provider.
  * @param Router $router \Illuminate\Contracts\Http\Kernel
  */
 public function boot(Router $router)
 {
     $this->loadViewsFrom(__DIR__ . '/Base/Views', 'backend');
     $this->bootBackend();
     $router->middleware('backend.guest', 'Darryldecode\\Backend\\Base\\Middleware\\RedirectIfAuthenticated');
     $router->middleware('backend.authenticated', 'Darryldecode\\Backend\\Base\\Middleware\\Authenticate');
     $this->publishes([__DIR__ . '/Public/backend/cb' => public_path('darryldecode/backend/cb'), __DIR__ . '/Public/backend/vendor' => public_path('darryldecode/backend/vendor')], 'public');
     $this->publishes([__DIR__ . '/Config' => config_path('backend')], 'config');
     $this->publishes([__DIR__ . '/Database/Migrations' => database_path('migrations'), __DIR__ . '/Database/Seeders' => database_path('seeds')], 'migrations');
     $this->publishes([__DIR__ . '/Components/Auth/Views' => base_path('resources/views/backend/auth')], 'views');
 }
开发者ID:darryldecode,项目名称:laravelbackend,代码行数:15,代码来源:BackendServiceProvider.php

示例15: routerize

 public function routerize(Router $router)
 {
     // Route for the admin controllers
     $router->middleware('admin', 'Mkny\\Cinimod\\Middleware\\Admin');
     $router->middleware('site', 'Mkny\\Cinimod\\Middleware\\Site');
     $router->group(['namespace' => $this->namespace], function ($router) {
         require mkny_path('\\Cinimod\\Controllers\\routes.php');
         // require mkny_path('\Cinimod\Controllers\routes.php');
     });
     // $this->routeResolver($router);
 }
开发者ID:mkny,项目名称:cinimod,代码行数:11,代码来源:CinimodServiceProvider.php


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