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

Equilibum's avatar

problems with retreive data from hasManyThrough relationship in laravel 4.2

I have 3 tables in DB.

  1. Workshops.
  2. Programs.
  3. ProgramWorkshops with 2 foreign keys (workshop_id, program_id);

I need to give all Workshops from Program model, how can i do this?

I use this: return $this->hasManyThrough('ProgramWorkshop', 'Workshop', 'id', 'workshop_id');

But Its not works.. ( Help me pls

0 likes
1 reply
Equilibum's avatar

SOLVED, USED "belongsToMany('Workshop', 'program_workshops')" Thanks all!

Please or to participate in this conversation.