$location = $details['location'];
$specializationAreasName = $details['specialization_areas'];
if($details['location'] == 'all'){
$location = '';
}
if($specializationAreasName == 'all'){
$specializationAreas = '1 = 1';
}
else{
$specializationAreas = "'specialization_areas','like', '%'".$specializationAreasName."'%'";
}
$result = Lawyers :: with('SkillsMappedToLawyer')
->where('location',$location)
->where($specializationAreas)
->take(10)->skip($skip)
->get();
Please find my code If the location == all then I want to search for all or else I need to search for the criteria which is dynamic. can some one help me to solve this ?