xxxxxxxxxx
Event::with(["owner", "participants" => function($q) use($someId){
$q->where('participants.IdUser', '=', 1);
//$q->where('some other field', $someId);
}])
xxxxxxxxxx
N + 1
return new SongsCollection(Song::with('album')->get());
'songs' => SongResource::collection($this->whenLoaded($this->songs))