Laravel 4 many to many relationship not working, pivot table not found

一世执手 提交于 2019-12-01 05:48:03

The pivot table should be singular version of the table names it is linking, in alphabetical order so in your case:

land_obj rather than lands_objs

If you really don't want to use the default naming conventions you can also specify the table name as the 2nd param on the belongsToMany call in your models:

return $this->belongsToMany('Obj', 'lands_objs');

and

return $this->belongsToMany('Land', 'lands_objs');

For more information see docs here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!