Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

esperanza's avatar

date filter does not include selected date

i use two dates to filter out my table data. but i does not takes values of date itself. only '>' and '<' values. how to use '<=' ?

 $allData = $this->data->where('checkedin', '>', $request->date_from)->where('checkedout', '<', $request->date_to)->orderBy('id', 'DESC')->paginate(15);
0 likes
1 reply
niseku's avatar
niseku
Best Answer
Level 2

Try this:

$allData = $this->data
    ->whereDate('checkedin', '>', $request->date_from)
    ->whereDate('checkedout', '<=', $request->date_to)
    ->orderBy('id', 'DESC')
    ->paginate(15);

1 like

Please or to participate in this conversation.