You've already forked lubo_comment_query
开放节目搜索功能,弹幕的title修改
This commit is contained in:
@ -9,10 +9,9 @@ use Illuminate\Routing\Controller as BaseController;
|
||||
class ProgramConstructController extends BaseController
|
||||
{
|
||||
public function construct(Request $request) {
|
||||
$keyword = $request->get("keyword", "");
|
||||
$programs = Programs::query()->with(["appends", "video_pivots.video"])->where("status", "=", 0)->limit(15)->orderByDesc("created_at")->get();
|
||||
$status = $request->get("status", "0");
|
||||
$programs = Programs::query()->with(["appends", "video_pivots.video"])->where("status", $status, 0)->limit(15)->orderByDesc("created_at")->get();
|
||||
return view("program.construct.index", [
|
||||
"keyword" => $keyword,
|
||||
"programs"=>$programs,
|
||||
]);
|
||||
}
|
||||
|
@ -10,9 +10,21 @@ class ProgramQueryController extends BaseController
|
||||
{
|
||||
public function index(Request $request) {
|
||||
$keyword = $request->get("keyword", "");
|
||||
$programs = Programs::query()->with(["appends", "video_pivots.video"])
|
||||
->where("status", "=", 1)->limit(15)->orderByDesc("created_at")
|
||||
->paginate(10)->withQueryString();
|
||||
$query = Programs::query()->with(["appends", "video_pivots.video"])->where("status", "=", 1)->orderByDesc("created_at");
|
||||
if ($keyword) {
|
||||
$keyword_split = explode(" ", $keyword);
|
||||
foreach ($keyword_split as $_keyword) {
|
||||
if (mb_strlen(trim($_keyword)) > 0) {
|
||||
$query->where(function ($_query) use ($_keyword) {
|
||||
$_query
|
||||
->where("name", "like", "%{$_keyword}%", "or")
|
||||
->where("difficulty", "like", "%{$_keyword}%", "or")
|
||||
->where("desc", "like", "%${_keyword}%", "or");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
$programs = $query->paginate(10)->withQueryString();
|
||||
return view("program.index", [
|
||||
"keyword" => $keyword,
|
||||
"programs"=>$programs,
|
||||
|
Reference in New Issue
Block a user