Esempio n. 1
0
 /**
  * Build all Menus.
  */
 public function buildMenus()
 {
     $menu = Menu::whereIsRoot()->get();
     foreach ($menu as $item) {
         LavaryMenu::make(Str::slug($item->name), function ($menu) use($item) {
             $this->buildMenuItems($menu, $item);
         });
     }
 }
Esempio n. 2
0
 /**
  * @internal param $generatedRecords
  */
 private function createMenuEntry()
 {
     $records = \Modules\Page\Entities\Page::where('published', 1)->take(3)->get();
     if ($main = Menu::root()->where(['name' => 'Main'])->first()) {
         foreach ($records as $element) {
             $main->children()->create(['name' => $element['title'], 'url' => "page/{$element['slug']}", 'active' => true]);
         }
     }
 }
Esempio n. 3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::table('menu__menus')->delete();
     // Main
     $main = Menu::create(['name' => 'Main']);
     $main->children()->create(['name' => 'SocietyCMS', 'url' => '', 'active' => true, 'attribute_class' => 'nav-header']);
     // Auth
     $auth = Menu::create(['name' => 'Auth']);
     $auth->children()->create(['name' => 'Login', 'url' => 'auth/login', 'active' => true]);
 }
Esempio n. 4
0
 /**
  * @return array
  */
 public function getMenuItems()
 {
     $items = [];
     $roots = Menu::roots()->visible()->get();
     foreach ($roots as $item) {
         $parent = $this->createItem($item->content->title)->setExtra('patterns', $this->extractPattern($item))->setUri($item->url);
         $this->attachChildren($item->children, $parent);
         $items[] = $parent;
     }
     return $items;
 }
Esempio n. 5
0
 /**
  *
  */
 private function createMenuEntry()
 {
     if ($main = Menu::root()->where(['name' => 'Main'])->first()) {
         $main->children()->create(['name' => 'Gallery', 'url' => 'gallery', 'active' => true]);
     }
 }
Esempio n. 6
0
 /**
  * @return \Illuminate\Support\Collection
  */
 protected function prepareParentItems()
 {
     $items = Menu::with('contents')->get()->lists('depth_title', 'id')->toArray();
     return [null => trans('menu::menu.root')] + $items;
 }
Esempio n. 7
0
 /**
  * @param Request $request
  *
  * @return mixed
  */
 public function store(Request $request)
 {
     $menu = Menu::create($request->input());
     return $this->response()->item($menu, new MenuTransformer());
 }
Esempio n. 8
0
 /**
  * @param Request $request
  *
  * @return mixed
  */
 public function destroy(Request $request, $id)
 {
     $node = Menu::where('id', $id)->first();
     $node->delete();
     return $this->response()->noContent();
 }