how to do a search with several filters as a parameter in laravel?

1

I have a question about how to search for clients with multiple filters.

Example: nome cliente , tipo de cliente , status do cliente , endereço , cidade .

Detail: All these filters are in different fields.

How to do this using Laravel's Eloquent?

    
asked by anonymous 31.08.2014 / 05:46

1 answer

2

By reviewing the documentation, go to link
have this example that will suit you very well:

MeuModel::where(function($query)
        {
            $query->where('votes', '>', 100)
                  ->orWhere('title', '<>', 'Admin');
        })
        ->get();

Then you can dynamically mount what you want, nesting as many "orWhere" as you need.

    
31.08.2014 / 16:36