/** * 获取前台控制菜单列表 */ public function menus() { if ($menus = MenusModel::all()) { return Tools::getChild($menus, $pid = 0); } return []; }
/** *查询方法 */ public function query($type, $isshow) { if ($type && $isshow) { $datas = MenusModel::where('type', $type)->where('isshow', $isshow)->orderBy('id', 'desc')->orderBy('sort', 'desc')->paginate($this->limit); } elseif (!$type && $isshow) { $datas = MenusModel::where('isshow', $isshow)->orderBy('id', 'desc')->orderBy('sort', 'desc')->paginate($this->limit); } elseif ($type && !$isshow) { $datas = MenusModel::where('type', $type)->orderBy('id', 'desc')->orderBy('sort', 'desc')->paginate($this->limit); } elseif (!$type && !$isshow) { $datas = MenusModel::orderBy('id', 'desc')->orderBy('sort', 'desc')->paginate($this->limit); } $datas->limit = $this->limit; return $datas; }
public function getMenus() { return MenusModel::orderBy('type', 'desc')->get(); }
public static function getMemberMenus() { return Tools::getChild(MenusModel::MemberMenus(), $pid = 0); }
public static function getCompanyMenus() { return Tools::getChild(MenusModel::CompanyMenus(), $pid = 0); }
/** * 得到公司后台左侧菜单 type==3 */ public static function CompanyMenus() { return MenusModel::where(['type' => 3, 'isshow' => 2])->orderBy('sort2', 'desc')->get(); }