DEV Community

loading...

Discussion on: Making the advanced search query with Eloquent-Builder in Laravel

Collapse
redon92 profile image
Redon

You can build the query with normal mysql syntax, then if you use a form, give the form name of the database field that you want to compare, and the value of the form input is the value you want to search for example 3, or some name. Then when the value returned is null, you normally don't take the field into the sql string. Its just some formatting you have to use in the controller, and its all automated, if the main purpose is directory listing or similar stuff

Thread Thread
mohammadfouladgar profile image
Fouladgar.dev Author

I suggest using the package once.
The query goes to the database only once.