K
K
Konstantin Tolmachev2018-08-17 11:01:43
Laravel
Konstantin Tolmachev, 2018-08-17 11:01:43

How can I link table data through Eloquent ORM and get the data I need?

Colleagues, I need a hint, I can’t understand how to execute this query through ORM
Introductory:
Simplified tables:

  • groups(id, curruculum_id, name)
  • Curriculum (id, name);
  • CurriculumDetail (id, name, (int)data1, disc_id, curruculum_id);
  • disc(id,name);
  • CurruculumDetailSemesterInfo(id, (int)data3, (int)data4, (int)data5, curriculum_detail_id)
Connections:
  • groups <- Curriculum HasMany
  • Curricum -> CurriculumDetail HasMany
  • CurriculumDetail -> CurruculumDetailSemesterInfo HasMany
  • CurriculumDetail <- Disc HasMany

Task:
Having groups select all CurriculumDetail and through them Disc where CurruculumDetailSemesterInfo data3 is equal to some value.
Question: Is it generally possible within a single request, or have I created too large a chain, and do I need to split everything into several requests?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Kovalchuk, 2018-08-17
@dark_tke

It's better to make one big request than
several small ones

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question