/** *查询方法 */ 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; }
/** * 得到公司后台左侧菜单 type==3 */ public static function CompanyMenus() { return MenusModel::where(['type' => 3, 'isshow' => 2])->orderBy('sort2', 'desc')->get(); }