Can eloquent ignore irrelevant data in Laravel 4

后端 未结 4 828
长发绾君心
长发绾君心 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:48

    @cheelahim is correct, When passing an array to Model::create(), all extra values that aren't in Model::fillable will be ignored.

    I would however, STRONGLY RECOMMEND that you do not pass Input::all() to a model. You really should be validating and verifying the data before throwing it into a model.

提交回复
热议问题