进行模型关联操作,

php artisan tinker

  执行

$user = App\Models\User::find(1)
$user->followings()->attach([2, 3])

  报错,模型关联定义都是OK的,google了一番,才发现原来是tinker的bug。直接在控制器中调用就没有报这个错误。如果你用tinker也报这个错了,试一下直接在控制器中操作。by the way,我用的是5.1版本

相关文章:

  • 2021-08-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-07
相关资源
相似解决方案