master
cody 5 months ago
parent 838864aa73
commit 0b5af7935c

@ -147,6 +147,10 @@ class CourseContentController extends BaseController
* @OA\Parameter(name="teacher_id", in="query", @OA\Schema(type="integer"), description="老师ID"),
* @OA\Parameter(name="address", in="query", @OA\Schema(type="string"), description="地址"),
* @OA\Parameter(name="theme", in="query", @OA\Schema(type="string"), description="主题"),
* @OA\Parameter(name="longitude", in="query", @OA\Schema(type="string"), description="经度"),
* @OA\Parameter(name="latitude", in="query", @OA\Schema(type="string"), description="纬度"),
* @OA\Parameter(name="address_detail", in="query", @OA\Schema(type="string"), description="详细地址"),
* @OA\Parameter(name="file_ids", in="query", @OA\Schema(type="string"), description="文件id数组"),
* @OA\Response(
* response=200,
* description="操作成功"

@ -6,9 +6,15 @@ namespace App\Models;
class CourseContent extends SoftDeletesModel
{
protected $casts = ['publicize_ids' => 'json'];
protected $casts = ['publicize_ids' => 'json', 'file_ids' => 'json'];
protected $appends = ['publicize'];
protected $appends = ['publicize', 'files'];
public function getFilesAttribute($value)
{
if (empty($this->file_ids)) return [];
return Upload::whereIn('id', $this->file_ids)->get();
}
public function getPublicizeAttribute($value)
{

@ -22,6 +22,9 @@ return new class extends Migration
$table->dateTime('start_time')->nullable()->comment('开始时间');
// 结束时间
$table->dateTime('end_time')->nullable()->comment('结束时间');
$table->json('file_ids')->nullable()->comment('文件id数组');
// 详细地址
$table->string('address_detail')->nullable()->comment('详细地址');
});
}

Loading…
Cancel
Save