hasOne(UploadFile::class, 'file_id', 'image_id') ->bind(['image_url' => 'preview_url']); } /** * @notes:获取全部记录 * @return array * @throws DataNotFoundException * @throws DbException * @throws ModelNotFoundException * @author: wanghousheng */ public function list(): array { return $this->with(['image']) ->where(['status' => 1]) ->order(['sort', 'create_time']) ->select() ->toArray(); } }