[英]Added new column to a table but updateOrCreate method won't update - Laravel
I just added a new column with php artisan make:migration
, and after that I called updateOrCreate
method hoping to filling the new column with values on all the existing records. 我只是用
php artisan make:migration
添加了一个新列,然后调用了updateOrCreate
方法,希望用所有现有记录中的值填充新列。
But nothing happened. 但是什么也没发生。 I tracked down and found that the parameter for the new column was passed right to
updateOrCreate
method. 我跟踪发现,新列的参数已正确传递给
updateOrCreate
方法。 But why was it not working? 但是为什么它不起作用? Thanks.
谢谢。
正如Jeemusu指出的那样,只是为了结束问题并给出答案,您需要在表模型内的$fillable
数组中添加新列-从而将其插入数据库中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.