philipbrown / magniloquent

DEPRECATED, USE https://github.com/dwightwatson/validating
MIT License
70 stars 8 forks source link

Attributes starting with an underscore are filtered out also. Renamed to purgeUnneeded to reflect new function. #11

Closed w3irdrobot closed 10 years ago

w3irdrobot commented 10 years ago
$user = new User();
$user->save(Input::all());

I use the above code alot when creating new users from a register form, for example. I ran into problems with this because it would include _token and _method in as attributes. When saving to the database, it throws an error because those are not fields in the table. I added some code to the purgeRedundant() method to filter these out as well. I also renamed that method to purgeUnneeded() to reflect its expanded usage.