Skip to content

Commit

Permalink
check table permissions exist
Browse files Browse the repository at this point in the history
  • Loading branch information
yohangdev committed Dec 23, 2015
1 parent cd42d73 commit 214ff72
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,20 @@ public function boot(Gate $gate)
$this->registerSeeds();
$this->registerConfigurations();

if (!$this->app->runningInConsole()) {
$this->registerAcl($gate);
}
$this->registerAcl($gate);


$this->registerCommands();
}

protected function registerAcl($gate)
{
$table_permissions_name = app('Laravolt\Acl\Models\Permission')->getTable();

if (! Schema::hasTable($table_permissions_name)) {
return false;
}

$gate->before(function ($user) {
$isAdmin = call_user_func(config('acl.is_admin'), $user);
if ($isAdmin) {
Expand Down

0 comments on commit 214ff72

Please sign in to comment.