调整页面

This commit is contained in:
2020-09-18 13:45:13 +08:00
parent 46d12cbf68
commit b8024dcace
14 changed files with 268 additions and 50 deletions

View File

@@ -20,12 +20,38 @@ class PatentController extends Controller
//显示文章列表
public function list(Request $request)
{
$type = $request->type;
$type = $request->type;
$title = $request->title;
$number = $request->number;
$category_id = $request->category_id;
$nickname = $request->nickname;
$publication = $request->publication;
$year = $request->year;
$patents = Patent::where('status', 1)
->when($type, function ($q) use ($type) {
$q->where('type', $type);
})
->when($title, function ($q) use ($title) {
$q->where('title', 'like', "%{$title}%");
})
->when($number, function ($q) use ($number) {
$q->where('number', $number);
})
->when($category_id, function ($q) use ($category_id) {
$q->where('category_id', $category_id);
})
->when($nickname, function ($q) use ($nickname) {
$q->where('nickname', 'like', "%{$nickname}%");
})
->when($publication, function ($q) use ($publication) {
$q->where('publication', $publication);
})
->when($year, function ($q) use ($year) {
$q->where('year', 'like', "%{$year}%");
})
->latest('sort')
->latest()
->paginate();
return view('patents.list', compact('patents'));