hasOne(UploadFile::class, 'file_id', 'image_id'); } /** * @notes:分类详情 * @param $where * @param array $with * @return static|array|null * @author: wanghousheng */ public static function detail($where, array $with = []) { return static::get($where, $with); } /** * @notes:获取全部记录 * @param array $where * @return array * @throws DataNotFoundException * @throws DbException * @throws ModelNotFoundException * @author: wanghousheng */ public function getList(array $where = []): array { $where = $this->setQueryDefaultValue($where); return $this->with(['image']) ->where($where) ->order(['sort', 'create_time']) ->select() ->toArray(); } }