dimanche 14 juillet 2019

Laravel 5.8: Trying to make a where model by using data pulled from database

This is my model:

$AVMatchCriteria = device::where([$AVMatch])->get();

I am creating the variable $AVMatch by using a foreach loop to run through the entries in my table, below is what it looks like if I echo it out.

["category", "=", "Server"],["siteid", "!=", "145228"],["udf8", "=", "asd"] 

When running my code I get the following error:

enter image description here

If i was to however just copy the string in plain text and put it in the model like below it works fine. I'm not sure why its not working but its putting a 0 = in my query somehow and im guessing thats the problem.

$AVMatchCriteria = device::where([["category", "=", "Server"],["siteid", "!=", "145228"],["udf8", "=", "asd"]])->get();

Any advice would be great :D



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire