You've already forked lubo_comment_query
							
							稿件查询支持搜索
This commit is contained in:
		| @@ -10,13 +10,24 @@ use Illuminate\Routing\Controller as BaseController; | ||||
| 
 | ||||
| class DanmakuQueryController extends BaseController | ||||
| { | ||||
|     public function index() | ||||
|     public function index(Request $request) | ||||
|     { | ||||
|         $video_list = Videos::query() | ||||
|         $keyword = $request->get("keyword", ""); | ||||
|         $query = Videos::query() | ||||
|             ->withCount("danmakus", "bilibili_danmakus", "ixigua_danmakus", "douyin_danmakus", "programs") | ||||
|             ->orderByDesc("created_at") | ||||
|             ->paginate(10)->withQueryString(); | ||||
|             ->orderByDesc("created_at"); | ||||
|         if ($keyword) { | ||||
|             $keyword_split = explode(" ", $keyword); | ||||
|             foreach ($keyword_split as $_keyword) { | ||||
|                 $_keyword = trim($_keyword); | ||||
|                 if (mb_strlen($_keyword) > 0) { | ||||
|                     $query->where("title", "like", "%{$_keyword}%"); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         $video_list = $query->paginate(10)->withQueryString(); | ||||
|         return view("danmaku.index", [ | ||||
|             "keyword" => $keyword, | ||||
|             "video_list" => $video_list, | ||||
|         ]); | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user