Hello Captbrogers,
You want to be using fillable exclusively. If you're using $guarded in a slightly outdated Laravel, you're in danger of SQL injection. The release notes of Laravel 4.1.29 dismiss this as merely a "risk of mass assignment", but it's quite a bit more dangerous than that.
More generally speaking, security-wise whitelists are always a better idea than blacklists, because blacklists are by their nature never entirely complete.
sjamaan is accurate in his last paragraph.
However, not all Eloquent models are saving user input, some models could be writing data that was generated by the application and have no origin from a user. If you have a lot of fields in your table, you can write a lot less code using $guarded
I assumed as such, good to know I was right. Thanks.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community