本文整理汇总了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');
}
示例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');
}
示例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);
});
}
示例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']);
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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');
}
示例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);
}
示例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');
}
示例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);
});
}
示例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();
}
示例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');
}
示例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);
}