Support the ongoing development of Laravel.io →
posted 8 years ago
Eloquent
Last updated 2 years ago.
0

You are checking the existence of a relationship? use whereHas.

0

Could you elaborate a little bit more on that? I believe is a relationship between Score and Cycle, so far I do have a field in Score which is cycle_id, I have in Scores a relationship with Dependencies, could I have two or more to different models entities?

0

I manage to make it work using a JOIN but now its not getting the Prizes information, any ideas?

App\Sector::with( array('dependencies' => function($query) { $query->with( array('scores' => function($query){	$query->join('cycles', 'scores.cycle_id', '=', 'cycles.id')->where( DB::raw('YEAR(cycles.starts)'), '=', '2016')->with('prizes'); }) ); }) )->get();
0

Sign in to participate in this thread!

Eventy

Your banner here too?

JWBrownie jwbrownie Joined 1 Mar 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.