Can eloquent ignore irrelevant data in Laravel 4

后端 未结 4 863
长发绾君心
长发绾君心 2021-01-27 10:33

I have a form that accepts data which will be used to create two new database table entries. The form takes both the users details and their address. The user details will be st

4条回答
  •  不要未来只要你来
    2021-01-27 10:47

    You'll have to unguard that model using these http://laravel.com/docs/eloquent#mass-assignment and then manually unset those values before you execute save(). I highly recommend using a form object or something similar to complete this kind of service for you outside of your model since it's safer and usually clearer to intended behavior.

提交回复
热议问题