public function getBooks($input)
{
$books= Book::where('book_name', 'LIKE', '%' . $input . '%')->get();
return Response::json($books);
}
I know how to filter a column by a given value. But how do I filter ALL columns by a given value. For example, I have a column called 'category' where user should be able to use the same search bar to filter the category.
Something like:
$books = Book::where('all_columns', 'LIKE', '%' . $input . '%')->get();
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…