Answer the question
In order to leave comments, you need to log in
How to do a search in Laravel 5.4?
I googled for a long time and searched in the documentation, I didn’t find how to make the simplest search on my site, which takes values from the form and goes through the database without connecting any extra libraries. The most default search.
Please feel free to share links or search methods.
Answer the question
In order to leave comments, you need to log in
If you have mysql as your database, search with LIKE. If postgres, then it has full text search out of the box. Alternatively, you can connect sphinx or elasticsearch.
Switching to WordPress?
UPD:
Are you seriously subscribing to this question?
Okay, the simplest one:
Route::post('/search', '[email protected]'); // can be get
In the method News::where('title', 'LIKE', '%' . $request->query . '%')->get();
Delov then.
Don't believe that like is bad.
Ps: you are bots, right?)
I think you first need to read about the basics of website building.
PS https://laravel.com/docs/5.4/queries#where-clauses
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question