I am trying to filter the age like 15 to 30 years old or something like that.Here is how i tried to,
<div class="form-group col-md-4">
<input type="text" name="first_age" placeholder="From">
</div>
<div class="form-group col-md-4">
<input type="text" name="second_age" placeholder="To">
</div>
And in my MyModel.php
public function scopeSearch($query, $request)
{ if ($request->first_age!='') {
$query->whereBetween('age', [$request->first_age, $request->first_age]);
}
return $query->select('jobseekers.*');
}
Can anyone guide me where am i wrong? Thanks in advance.