关联关系修正,拆分评论内容,默认进入至节目查询

This commit is contained in:
2022-08-01 10:12:56 +08:00
parent f2bb1bee88
commit fb78d7facb
2 changed files with 8 additions and 2 deletions

View File

@ -11,9 +11,14 @@ class Videos extends Model
return $this->hasMany(VideoComments::class, "aid", "id");
}
public function program_pivots(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(ProgramVideos::class, "video_bvid", "bvid");
}
public function programs(): \Illuminate\Database\Eloquent\Relations\HasManyThrough
{
return $this->hasManyThrough(Programs::class, ProgramVideos::class, "video_bvid", "bvid", "id", "program_id");
return $this->hasManyThrough(Programs::class, ProgramVideos::class, "video_bvid", "id", "bvid", "program_id")->orderBy("created_at");
}
public function danmakus(): \Illuminate\Database\Eloquent\Relations\HasMany