Psst.. new poll here.
[email protected] webmail now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!
Paste
Pasted as PHP by linh ( 3 years ago )
public function getBookSearch(Request $request)
{
// dd($request->keyword, $request->filter_category);
$keyword = $request->keyword;
$category = $request->filter_category;
$book = Book::join('book_category','book_category.book_id','=','books.id');
if ($keyword) {
$book = $book->where('books.name', 'like', '%' . "{$keyword}" . '%');
}
if ($category) {
$book = $book->where('book_category.category_id', $category);
}
$books = $book->get();
dd($books);
return view('student.search-result', compact('books'));
}
Revise this Paste
Parent: 117566