Support the ongoing development of Laravel.io →
Eloquent

Im trying to simply get a tree back from eloquent.

Windows::with('event.action');

returns all actions, regardless of the window id.

How can I specify the the window id used to get transactions back for a specific window?

Currently all actions for an event are returned as the window_id column is being ignored.

Ive tried adding -withPivot on my relationship inside the events model. I have also tried putting in a closure on the with(['events.actions'=>function($q( {.etc..}]) but this is no use because I dont have access to the window id in the closure scope.

window 
 id
 name

events_windows
 window_id
 event_id

event
 id
 name

actions_events
 window_id
 event_id
 action_id

action
 id
 name


transition
 id
 name

Any ideas?

Cheers, Tom

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.

© 2025 Laravel.io - All rights reserved.