关联关系修正,拆分评论内容,默认进入至节目查询
This commit is contained in:
parent
f2bb1bee88
commit
fb78d7facb
@ -11,9 +11,14 @@ class Videos extends Model
|
|||||||
return $this->hasMany(VideoComments::class, "aid", "id");
|
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
|
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
|
public function danmakus(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
|
@ -13,7 +13,8 @@ use Illuminate\Support\Facades\Route;
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
// 对外列表
|
// 对外列表
|
||||||
Route::get('/', ["\\App\\Http\\Controllers\\CommentQueryController","index"]);
|
Route::redirect('/', '/programs');
|
||||||
|
Route::get('/comments', ["\\App\\Http\\Controllers\\CommentQueryController","index"]);
|
||||||
Route::get('/programs', ["\\App\\Http\\Controllers\\ProgramQueryController","index"]);
|
Route::get('/programs', ["\\App\\Http\\Controllers\\ProgramQueryController","index"]);
|
||||||
Route::get('/programs/{program}/video', ["\\App\\Http\\Controllers\\ProgramQueryController","videos"]);
|
Route::get('/programs/{program}/video', ["\\App\\Http\\Controllers\\ProgramQueryController","videos"]);
|
||||||
Route::get('/danmakus', ["\\App\\Http\\Controllers\\DanmakuQueryController","index"]);
|
Route::get('/danmakus', ["\\App\\Http\\Controllers\\DanmakuQueryController","index"]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user