ddoddsr
modifyQueryUsing ->join changes $record->id
This is very promising . The vars
$client_id,$csm_id, $am_id
are Undefined in the if statements that contain the where, whereHas . I just had to change to ->modifyQueryUsing(function(Builder $query) use ($client_id,$csm_id, $am_id) {
adding the use
and change $query->whereHas('users',
to $query->whereHas('client',
to fit my models. (for other readers benefit).6 replies