From 615ed5e0a62276025da80436ca8d61f958fc132b Mon Sep 17 00:00:00 2001 From: Bayu Hendra Winata Date: Mon, 20 Jan 2020 07:11:11 +0700 Subject: [PATCH] Check if laravolt platform bound Only register menu and permission if related service loaded --- src/ServiceProvider.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 7c2f1ea..6ff4a68 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -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; }