vendredi 24 novembre 2017

How to generate a query to db if several "where" are added in the loop?

I have a method with two incoming arrays. The first array $columns[] contains columns names. The second one $filters[] contains search filters. How can I sort through all the values of these columns using only one search query? I can not figure out how this is done through "Eloquent". I want generate something like this:

$data::where($columns[0], '=', $filters[0])
            ->where($columns[1], '=', $filters[1])
            ...
            ->where($columns[n], '=', $filters[n])



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire