When i join two tables in search handler there is a same column in both tables, i cannot access the value of left table for example if there are two tables user and volunteers they both have id column when I write a search handler like this
$builder->join('users', 'volunteers.user_id', "=", "users.id")
->join('policies','volunteers.policy_id',"=","policies.id")
->where(function($q) use ($whereConditions){
$q->where('users.first_name','like','%'.$whereConditions['OR'][0]['value'].'%');
$q->orWhere('users.last_name','like','%'.$whereConditions['OR'][0]['value'].'%');
$q->orWhere('policies.name','like','%'.$whereConditions['OR'][0]['value'].'%');
$q->orWhere('volunteers.experiences','like','%'.$whereConditions['OR'][0]['value'].'%');
$q->orWhere('volunteers.medical_facility','like','%'.$whereConditions['OR'][0]['value'].'%');
});
and when i query, it will return user id as volunteer id
I want the volunteer id but I always get the user id. I hope the question is clear
I implemented your problem and the problem happened to me but I solved it by using $builder->select('your columns')
.