diff --git a/src/PermitServiceProvider.php b/src/PermitServiceProvider.php index db6c8dc..8a11633 100644 --- a/src/PermitServiceProvider.php +++ b/src/PermitServiceProvider.php @@ -33,7 +33,12 @@ public function register() \Nahid\Permit\Commands\RemovePermissionCommand::class, ]); - $this->app->routeMiddleware(['permit' => \Nahid\Permit\Middleware\PermitMiddleware::class]); + if ($this->app instanceof LaravelApplication) { + $this->app['router']->aliasMiddleware('permit', \Nahid\Permit\Middleware\PermitMiddleware::class); + } elseif ($this->app instanceof LumenApplication) { + $this->app->routeMiddleware(['permit' => \Nahid\Permit\Middleware\PermitMiddleware::class]); + } + } /** * Setup the config.