You've already forked lubo_comment_query
图标,及抖音支持
This commit is contained in:
@ -11,7 +11,10 @@ class DanmakuQueryController extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$video_list = Videos::query()->withCount("danmakus")->orderByDesc("created_at")->paginate(10);
|
||||
$video_list = Videos::query()
|
||||
->withCount("danmakus", "bilibili_danmakus", "ixigua_danmakus", "douyin_danmakus")
|
||||
->orderByDesc("created_at")
|
||||
->paginate(10);
|
||||
return view("danmaku.index", [
|
||||
"video_list" => $video_list,
|
||||
]);
|
||||
|
@ -20,4 +20,19 @@ class Videos extends Model
|
||||
{
|
||||
return $this->hasMany(VideoDanmakus::class, "video_bvid", "bvid");
|
||||
}
|
||||
|
||||
public function bilibili_danmakus(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->danmakus()->where("platform_id", "=", 1);
|
||||
}
|
||||
|
||||
public function ixigua_danmakus(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->danmakus()->where("platform_id", "=", 2);
|
||||
}
|
||||
|
||||
public function douyin_danmakus(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->danmakus()->where("platform_id", "=", 3);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user