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

rajaduraioec's avatar

Laravel join tables query

Hi How can we build query in laravel for the below

SELECT routes.id, src.title, dest.title, groups.title FROM routes INNER JOIN locations as src ON (src.id = routes.src) INNER JOIN locations as dest ON (dest.id = routes.dest) INNER JOIN groups ON (groups.id = routes.groups) order by routes.id

tables

  1. depots(id, title)
  2. groups(id, title)
  3. routes(id, origin, destination, group_id) origin and destination are mapped with depots id.
0 likes
1 reply

Please or to participate in this conversation.