本文整理汇总了PHP中Illuminate\Routing\Router::middlewareGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::middlewareGroup方法的具体用法?PHP Router::middlewareGroup怎么用?PHP Router::middlewareGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\Router
的用法示例。
在下文中一共展示了Router::middlewareGroup方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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']);
}
示例2: boot
public function boot(Router $router)
{
$router->middlewareGroup('api', [\KodiCMS\API\Http\Middleware\VerifyApiToken::class]);
Auth::viaRequest('token', function ($request) {
return app(TokenGuard::class)->user($request);
});
}
示例3: 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);
}
示例4: __construct
/**
* Create a new HTTP kernel instance.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function __construct(Application $app, Router $router)
{
$this->app = $app;
$this->router = $router;
foreach ($this->middlewareGroups as $key => $middleware) {
$router->middlewareGroup($key, $middleware);
}
foreach ($this->routeMiddleware as $key => $middleware) {
$router->middleware($key, $middleware);
}
}
示例5: 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;
}
示例6: boot
/**
* @param IlluminateRouter $router
*/
public function boot(IlluminateRouter $router)
{
$this->config = config('modulair-router');
$assetsPath = __DIR__ . '/../assets';
$migration = __DIR__ . '/../migrations';
$configPath = __DIR__ . '/../config/modulair-router.php';
$this->publishes([$configPath => $this->getConfigPath()], 'config');
$this->publishes([$assetsPath => $this->getAssetsPath()], 'assets');
$this->publishes([$migration => $this->getMigrationsPath()], 'migrations');
$this->loadViewsFrom(__DIR__ . '/Resources/Views/', 'd5300.router');
$router->middlewareGroup('CheckMissingRoutes', [CheckMissingRoute::class]);
$router->middleware('routeDevelopmentMode', DevelopmentMode::class);
}
示例7: routes
private function routes(Router $router)
{
$router->middleware('djem.auth', \DJEM\Http\Middleware\Authenticate::class);
$router->middlewareGroup('djem.web', [\Illuminate\Cookie\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \DJEM\Http\Middleware\VerifyCsrfToken::class]);
Route::group(['middleware' => ['djem.web', 'djem.auth'], 'namespace' => '\\DJEM\\Http\\Controllers'], function () {
Route::any('djem/api', 'Api@getState');
Route::any('djem/api/tree', 'Api\\Main@tree');
Route::any('djem/api/grid', 'Api\\Main@grid');
Route::any('djem/api/content/delete', 'Api\\Content@delete');
Route::any('djem/api/content/load', 'Api\\Content@loadRelation');
Route::get('djem/api/content', 'Api\\Content@get');
Route::post('djem/api/content', 'Api\\Content@set');
Route::get('djem/api/files', 'Api\\Files@get');
Route::post('djem/api/files/upload', 'Api\\Files@upload');
Route::post('djem/api/files', 'Api\\Files@set');
});
Route::get('djem/{file?}', '\\DJEM\\Http\\Controllers\\StaticFiles@get')->where('file', '.*');
}
示例8: middlewareGroup
/**
* Register a group of middleware.
*
* @param string $name
* @param array $middleware
* @return $this
* @static
*/
public static function middlewareGroup($name, $middleware)
{
return \Illuminate\Routing\Router::middlewareGroup($name, $middleware);
}
示例9: boot
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot(\Illuminate\Routing\Router $router)
{
$router->middleware('instaPack', 'Kaankilic\\InstaPack\\Http\\Middleware\\InstaMiddleware');
$router->middlewareGroup('web', ['Kaankilic\\InstaPack\\Http\\Middleware\\SetupHandler']);
$this->publishes([__DIR__ . '/../../config/instapack.php' => base_path('config/instapack.php')]);
}