How can I get information using Lockable with chained Join?

Asked

Viewed 223 times

0

I have 3 layers of entities, of which I only want the third object. but based on the information of the first 2.

For example, I have manufactures that manufactures cars and each car has a kind of wheel. I want all the wheels manufactured by a factory.

I don’t know how to do this using eloquent, The only idea I had was to make several hasMany to get this data. but I’m afraid it’s not the most efficient way because I’ll end up taking data that won’t be used.

I tried it but it didn’t work as well as I wanted.

DB::raw('select results from hectars h,consultas c,results r where h.id_fazendeiro=? and h.id=c.id_hectar and c.id = r.id_consulta',[$id]);

1 answer

0

  • It is not quite what I wish. It is more to chain various objects. I have information of the father, and I want all fulhos.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.