/** * 多对多关联管理角色 * @return BelongsToMany */ public function roles() { return $this->belongsToMany( Role::class, 'manager_role', 'role_id', 'manager_id' ); }
foreach ($manager->roles as $item){ dd($item->pivot->toArray()); }