* +---------------------------------------------------------------------- */ /** * 投诉管理 * @author crud自动生成代码 * @date 2023/10/16 15:26:40 */ namespace app\dao\crud; use app\dao\BaseDao; use app\model\crud\UserComplaint; /** * Class UserComplaintDao * @date 2023/10/16 * @package app\dao\crud */ class UserComplaintDao extends BaseDao { /** * 设置模型 * @return string * @date 2023/10/16 */ protected function setModel(): string { return UserComplaint::class; } /** * 搜索 * @param array $where * @return \crmeb\basic\BaseModel * @throws \ReflectionException * @date {%DATE%} */ public function searchCrudModel(array $where = [], $field = ['*'], string $order = '', array $with = []) { return $this->getModel()->field($field)->when($order !== '', function ($query) use ($order) { $query->order($order); })->when($with, function ($query) use ($with) { $query->with($with); })->when(!empty($where['school_name']), function($query) use ($where) { $query->whereLike('school_name', '%'.$where['school_name'].'%'); }); } }