@shami003 try this
$absentees = AbsenteeRecord::whereIn('student_id', $student_ids)
->whereDate('from_date', '>=', $from_date)
->whereDate('to_date', '<=', $to_date)
->get();
be sure your $from_date and $to_date have appropriate format
if sometimes you have just 1 value (for example, $from_date, but $end_date is null) use this https://laravel.com/docs/8.x/queries#conditional-clauses
$absentees = AbsenteeRecord::whereIn('student_id', $student_ids)
->when($from_date, function ($query, $from_date) {
return $query->whereDate('from_date', '>=', $from_date)
})
->when($to_date, function ($query, $to_date) {
return $query->whereDate('to_date', '>=', $to_date)
})
->get();