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

pbnskd's avatar

laravel join with count

can anyone help me with laravel join with count I’m trying to get the laravel to join with a count of three tables where table 1 one is a relationship with table 2 and table 3 Which display data of table1 and table and the count value of table three only with a relationship with table1 Table name: table1

Id name

1 a1

2 a2

3 a3

table name : table2 id 2name table1_id

1 b1 1

2 b2 2

3 b3 3

table name : table3

id 3name table1_id

1 c1 1

2 c2 1

3 c3 2

4 c4 2

4 c5 3

Output need Name 2name (count 3name)

a1 b1 2

a2 b2 2

a3 b3 1

0 likes
1 reply

Please or to participate in this conversation.