laravel 5.4 many to many relationship
问题 i have relationship many to many table 'admins' , 'pjt_roles' with pjt_role_admin. but,not working i have 2 model class Role protected $table = 'pjt_roles'; public function Admin(){ return $this->belongsToMany(Admin::class',pjt_role_admin'); } class Admin public function Role(){ return $this->belongsToMany(Role::class,'pjt_role_admin'); } and table pjt_role_admin have attribute admin_id from table admins role_id from table pjt_roles 回答1: Specify your pivot table in relationship. Default