/** *查询方法 */ 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(); }