Skip to content
Advertisement

How can I chain Laravel requests properly for a search?

I have a search form where I take several parameters and I return the results narrowed down. However, I don’t get how I can chain the requests properly.

Like, I can’t put Candidate::all() to have all the values and narrow them down since it’s a collection. How can I make sure that my request will follow from the past request?

Here’s is my request (only the first parameter).

So, how can I chain them properly?

JavaScript

Advertisement

Answer

You can add conditions on the query builder instance from Candidate::query()

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement