I am calling URL with search params which are dynamic. How could I form proper Eloquent query?
In theory:
- query
- query where(someParam1)
- query where(someParam2)
- query orderby(someParam3)
- query get
I need this kind of structure so I can use where clause if param exists. If there is some other way in Laravel, please let me know.
You can pass dynamic value by below example
I came here from Google. If you are going to be iterating over more then 5 if statements, its more effective to use a switch statement
It's easy with Laravel. Just do something like this: