I am using Laravel 4 to create a RESTful interface for my AngularJS app.
At the moment, I want to update an object. My model is called Discount Link
The way I do this is:
$data = Input::all();
$affectedRows = DiscountLink::where('id', '=', $id)->update($data);
(Please imagine there are some kind of validation checks)
I get an error in my laravel.log
:
General error: 1 no such column: $edit
Edit is a value that was passed to my server because it was added in by angular. I don't see the need to explicitly remove this in my JS so my question is:
How can I create some kind of whitelist of key-names that my model will pay attention to. That way, even if something get's passed in by accident, the REST call doesn't have to fail.
I guess there are arguments for sanitising in the JS but i will then pollute my code with many de-assignment statements which could become messy, especially when dealing with AngularJS:
delete discountLink.$edit;
Any suggestions?