Support the ongoing development of →
Database Eloquent
Last updated 3 months ago.

If I speak in the tongues of mortals and of angels, but do not have love, I am a noisy gong or a clanging cymbal. And if I have prophetic powers, and understand all mysteries and all knowledge, and if I have all faith, so as to remove mountains, but do not have love, I am nothing. If I give away all my possessions, and if I hand over my body so that I may boast, but do not have love, I gain nothing.Love is patient; love is kind; love is not envious or boastful or arrogant or rude. It does not insist on its own way; it is not irritable or resentful; it does not rejoice in wrongdoing, but rejoices in the truth. It bears all things, believes all things, hopes all things, endures all things.



try Crew::find(102)->events()->get();


I solved it this morning. It should be something like this

return $this->hasMany('App\Models\Scheduling\Event');
return $this->belongsTo('App\Models\Scheduling\Crew');

or alternatively, I had to switch the crew_id and id fields around

return $this->hasMany('App\Models\Scheduling\Event', 'crew_id', 'id');
return $this->belongsTo('App\Models\Scheduling\Crew', 'id', 'crew_id');

Sign in to participate in this thread!


Your banner here too?

jirwin jirwin jirwin Joined 4 Aug 2015


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

Your logo here?

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

© 2022 - All rights reserved.