Skip to content

Commit

Permalink
fixed: lumen and laravel compitibility
Browse files Browse the repository at this point in the history
  • Loading branch information
nahid committed Dec 25, 2018
1 parent d1b0733 commit 164c4ea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/PermitServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 164c4ea

Please sign in to comment.