return User::join('personal_info','users.id','=','personal_info.user_id')
->leftJoin('user_data', function ($q) use ($filters) {
$q->on('users.id', '=','user_data.user_id');
foreach ( $filters as $field => $value ) {
$q->where($field,'=',$value)
}
});
This will specifically add the filters to the join i.e. leftJoin t2 on t1.1 = t2.2 AND filter = val
In this way you can join the specific records that match all filters applied