Kyle
Kyle

Reputation: 115

Comparing smaller date range to a bigger one

I'm targeting a filter for an in-between date range. I do already have the basic filter

->where('from', '>=', $from)->where('to', '<=', $to)


example:

Date range to get: 01/01/2019 - 15/01/2019

Date range to use: 02/01/2019 - 03/01/2019

I should get the date range 01/01/2019 since it the range I use is in-between

Upvotes: 0

Views: 52

Answers (1)

Kyle
Kyle

Reputation: 115

Flipped the condition and it somehow work:

->where('from', '<=', $from)
->where('to', '>=', $to)

Upvotes: 1

Related Questions