I have a routine that reads a list of eloquent commands (from an input to the route/controller or via a file):
eg:
Product::where('code', '=', 'ABC123')->update(array('price' => 123.45));
Product::where('code', '=', 'ABC246')->update(array('price' => 222.99));
How do I get Laravel to execute these, as if it was building them itself?
I know that I can use PHP's eval()
method, but only as a last resort. The commands being passed through are generated by another internal system of ours, so there is no problems with this being exploited, however am hoping for a better option than eval()
.