S
S
Scryppi2017-04-18 18:08:16
Laravel
Scryppi, 2017-04-18 18:08:16

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

3 answer(s)
A
Alexander Melikhov, 2017-04-18
@Scryppi

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.

D
DeadMemories, 2017-04-18
@DeadMemories

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?)

S
Stanislav Pochepko, 2017-04-18
@DJZT

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 question

Ask a Question

731 491 924 answers to any question