// +---------------------------------------------------------------------- namespace app\common\dao\system; use app\common\dao\BaseDao; use app\common\model\BaseModel; use app\common\model\system\AppUpdate; use think\db\exception\DbException; /** * Class AppUpdateDao * @package app\common\dao\system * @author xaboy * @day 2020-04-24 */ class AppUpdateDao extends BaseDao { /** * @return BaseModel * @author xaboy * @day 2020-03-30 */ protected function getModel(): string { return AppUpdate::class; } public function search(array $where = []) { return AppUpdate::getDB() ->when(isset($where['id']) && $where['id'] !== '',function($query) use($where){ $query->where('id',$where['id']); }) ->when(isset($where['type']) && $where['type'] !== '',function($query) use($where){ $query->where('type',$where['type']); }); } public function delete(int $id) { return ($this->getModel()::getDB())->where('id', $id)->delete(); } }