Skip to content

Commit

Permalink
Check if laravolt platform bound
Browse files Browse the repository at this point in the history
Only register menu and permission if related service loaded
  • Loading branch information
uyab committed Jan 20, 2020
1 parent 798c66b commit 615ed5e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,22 @@ public function boot()

protected function bootMenu()
{
$menu = app('laravolt.menu')->system;
$menu->add(__('Menu Manager'), url('menu-manager/menu'))
->data('icon', 'bars')
->data('permission', Permission::MANAGE_MENU)
->active(config('laravolt.menu.route.prefix') . '/menu/*');
if (app()->bound('laravolt.menu')) {
$menu = app('laravolt.menu')->system;
$menu->add(__('Menu Manager'), url('menu-manager/menu'))
->data('icon', 'bars')
->data('permission', Permission::MANAGE_MENU)
->active(config('laravolt.menu.route.prefix') . '/menu/*');
}

return $this;
}

protected function bootPermission()
{
$this->app['laravolt.acl']->registerPermission(Permission::toArray());
if (app()->bound('laravolt.acl')) {
app('laravolt.acl')->registerPermission(Permission::toArray());
}

return $this;
}
Expand Down

0 comments on commit 615ed5e

Please sign in to comment.