public function edit($id)
 {
     $Menu = App::make('Menu');
     $menus = $Menu::all();
     $menu_list = array('' => 'None');
     foreach ($menus as $menu) {
         $menu_list[$menu->id] = $menu->name;
     }
     $this->data['menu_list'] = $menu_list;
     return parent::edit($id);
 }
Beispiel #2
0
    public function delete($id, $ajax = null)
    {
        $Menu = App::make('Menu');
        $MenuItem = App::make('MenuItem');
        $menu = $Menu::findOrFail($id);
        if ($MenuItem::where('child_menu_id', $menu->id)->count()) {
            return Redirect::to($this->uri('edit/' . $menu->id))->withErrors('
				You cannot delete a menu while it is another menu\'s child.
			');
        }
        if ($MenuItem::whereNotNull('child_menu_id')->where('menu_id', $menu->id)->count()) {
            return Redirect::to($this->uri('edit/' . $menu->id))->withErrors('
				You cannot delete a menu while it has child menus.
			');
        }
        return parent::delete($id);
    }