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.
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 thepurgeRedundant()
method to filter these out as well. I also renamed that method topurgeUnneeded()
to reflect its expanded usage.