/** * Removing a Menu must also reset all pages to menu_id = 0 (put in Unsorted Pages) * @param $menu_id * @return mixed */ public function removeMenu($menu_id) { //Remove $menu = Menu::find($menu_id); $menu->delete(); //Set any pages with current menu_id to menu_id = 0 = Unsorted, also set new parent_id to 0 $pages = Page::where("id", "=", $menu_id)->update(array('menu_id' => 0, 'parent_id' => 0)); return Redirect::route('cmsEdit')->with('flash_notice', Lang::get('cms::m.menu-removed')); }
/** Mark as Home */ public function MarkAsHome($pageId) { $page = Page::find($pageId); if (!empty($page->id)) { //remove any other page as home Page::where("is_home", "=", 1)->update(array('is_home' => 0)); //Set new page as home $page->is_home = 1; $page->save(); } }