且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

laravel类型错误:传递给Illuminate \ Database \ Eloquent \ Model :: save()的参数1必须为数组类型,给定对象

更新时间:2021-08-04 21:24:26

我认为您只需要使用不带任何参数的save()方法.我已经在php artisan tinker中以相同的结构进行了尝试.在遇到相同的错误后,我尝试删除save()方法中的$entity参数:

I think you just need to use save() method without any parameters. I have try it in php artisan tinker with same structure. And after I get same error, I try to remove the $entity parameter inside save() method:

// After update, you should only use save() not save($entity)
$entity->address->save(); 

我希望我能为您的问题提供正确答案:-D

I hope I give correct answer for your problem :-D