0
If I understand, I think this is what you need. I left in the standard form and also in the eloquent
select ug.setor_id, setors.nome, ug.group_id, groups.descricao
from users_groups_has_users as ug
inner join groups on groups.id = ug.group_id
inner join setors on setors.id = ug.setors_id
$query = DB::table('users_groups_has_users')->join('groups', 'join groups on groups.id', '=', 'users_groups_has_users.group_id')->join('setors', 'join setors on setors.id', '=', 'users_groups_has_users.setor_id')
->select('ug.setor_id', 'setors.nome', 'ug.group_id', 'groups.descricao')->get()
Put the part of the Models code where you made the relationships, it’s easier to help you. ;)
– Kayo Bruno