How I can short my code when request have many parameters
https://laravel.com/docs/5.7/queries#where-clauses

$where = [];
if($city) {
    $where[] = ['city_id', '=', $city];
}
if($sex) {
    $where[] = ['sex', '=', $sex];
}
if($ageFrom) {
    $where[] = ['birthday', '&lt;=', date('Y-m-d', strtotime("-$ageFrom years"))];
}
if($ageTo) {
    $where[] = ['birthday', '&gt;=', date('Y-m-d', strtotime("-$ageTo years"))];
}
$candidates = Candidate::where($where)-&gt;get();