/** * the component navigation * * @return ComponentNavigationCollection */ public function getNavigation() { // the content builder navigation $contentBuilder = new ComponentNavigation('Content Builder', 'fa fa-th-large', url(config('backend.backend.base_url') . '/content_types')); $contentBuilder->setRequiredPermissions(['contentBuilder.manage']); // the form group:form builder:custom fields $formBuilder = new ComponentNavigation('Custom Fields', 'fa fa-list', url(config('backend.backend.base_url') . '/custom_fields')); $formBuilder->setRequiredPermissions(['contentBuilder.manage']); // the contents navigation $contentsNavigation = new ComponentNavigation('Contents', 'fa fa-book', '', true); // when "php artisan" command is run, all application registered services are run, // so during "php artisan package:publish" stuffs this will throw error as ContentType::all() // has no migrations yet. Let's try catch here so we can solve that problem try { foreach (ContentType::all() as $type) { $n = new ComponentNavigation($type->type, 'fa fa-pencil-square', url(config('backend.backend.base_url') . '/contents/' . $type->type)); // the permission requirements to check $permissionManage = $type->type . '.manage'; $n->setRequiredPermissions([$permissionManage]); $contentsNavigation->addSubMenu($n); } } catch (\Exception $e) { // there is an error, do nothing } $navs = new ComponentNavigationCollection(); $navs->push($contentBuilder); $navs->push($formBuilder); $navs->push($contentsNavigation); return $navs; }
/** * the component navigation * * @return ComponentNavigationCollection */ public function getNavigation() { $users = new ComponentNavigation('Users', 'fa fa-users', url(config('backend.backend.base_url') . '/users')); $users->setRequiredPermissions(['user.manage']); $navCollection = new ComponentNavigationCollection(); $navCollection->push($users); return $navCollection; }
/** * the component navigation * * @return ComponentNavigationCollection */ public function getNavigation() { $mediaManager = new ComponentNavigation('Media Manager', 'fa fa-files-o', url(config('backend.backend.base_url') . '/media_manager')); $mediaManager->setRequiredPermissions(['media.manage']); $navCollection = new ComponentNavigationCollection(); $navCollection->push($mediaManager); return $navCollection; }
/** * the component navigation * * @return ComponentNavigationCollection */ public function getNavigation() { // the content builder navigation $customNavigationBuilder = new ComponentNavigation('Navigation Builder', 'fa fa-align-justify', url(config('backend.backend.base_url') . '/navigation/builder')); $customNavigationBuilder->setRequiredPermissions(['navigationBuilder.manage']); $navs = new ComponentNavigationCollection(); $navs->push($customNavigationBuilder); return $navs; }