Hey guys (and girlies)
Can someone point out to validate / search for a date range within a date range? I am using Laravel PHP but raw SQL will be perfect as well.
I want to validate if a date range exists, within a date range. Basically I want a solid validation to avoid overlapping date ranges.
Example (and the concept I have at the moment) (laravel syntax)
->where('start_date','>=',$myrange_start)
->where('start_date','<=',$myrange_end)
Which will validate for for a start date in the database between the date range
and
->where('start_end','>=',$myrange_start)
->where('start_end','<=',$myrange_end)
Which will validate for for an end date in the database between the date range
And which has also kind of worked for me is
->whereRaw('? between start_date and end_date', [$today])
however, what I want to achieve is to say something like
->whereRaw('? between start_date and end_date', [$myrange_start, $myrange_end])
so see if there are date ranges which
a) start: on start, between start and end, on end b) start: on end c) end: on start, between start and en, on end d) start BEFORE start date and ends AFTER ends date e) start AFTER start date and ends BEFORE end date
Is this possible?