Does anyone know if this new feature can be performed on multiple relationships?
For example, I have a query where I want to filter on not only the club name (relate
Thanks to being shown in the right direction by edi9999 - I wasn't properly considering parameter grouping
use
the main eloquent object in the anonymous function, I placed a whereHas and an orWhereHas constraint on the homeClub and awayClub and that did the trick.
$ret->with('territory')->with('homeClub')->with('awayClub')->with('programme');
$ret
->whereHas('territory',function( $query ) use ( $parameterValues ){
$query->where('region', $parameterValues['region_names'] );
})
->whereHas('season', function ( $query ) use ( $parameterValues ){
$query->where('name', $parameterValues['season_names'] );
})
->where( function( $subquery ) use ( $ret ){
$ret->whereHas('homeClub', function ( $query ){
$query->where('name','Arsenal' );
} );
$ret->orWhereHas('awayClub', function ( $query ){
$query->where('name','Arsenal');
});
});