I need to have a query builder. The only way I have come up with is to make a string, and on the string form the eloquent query. I only have problem executing the query.
$variable = "where('a','asd')->get()";
return Modelo::$variable;
This error comes out:
Access to undeclared static property: App\Models\Api\Ela\Model::$variable"
You can build the Eloquent query based on what you get as follows:
According to what I understood, different parameters arrive through json to build the query, assuming that one of those filters that you receive is called filter_name, and after encoding and processing the json or however you want to handle it, what came in that parameter is saved in a variable
$filtro_nombre
or the same isnull
;Now if you want you can also use Query Builder:
I hope it helps.
Cheers!