Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

zafirus's avatar

Query database of 3 tables using Laravel

I have 3 tables:

Table: faction id_faccao name

Table: faccao_relacao id_relating_factory id_faccao_1 id_faccao_2

Table: relacao_faccao id_relating_factory name

The field id_relacao_faccao of the table faccao_relacao refers to id_relacao_faccao of the table relacao_faccao.

The fields id_faccao_1 and id_faccao_2 of the faccao_relacao table refer to the faccao_id of the faccao table.

I want the query to return me: names of the faction table (id_faccao_1 and id_faccao_2), and name of table relacao_faccao

0 likes
2 replies

Please or to participate in this conversation.