Closed frenchqwerty closed 1 year ago
Hi you can use
protected $dates = ['startDate', 'endDate']; //<- this text should be add in model
$d = WorkPeriod::where('startDate', '>=', Carbon::parseFromLocale($this->start))->where('endDate','<=',Carbon::parseFromLocale($this->end));
$this->start = can be string no problem with parseFromLocale also you can use whereDate()
Thanks @puuble for the correct answer.
$dates
is now replaced by $casts
.
Description:
I have a date array and I want to retrieve those that are an interval.
For example: Retrieve me those with a date between 2023-03-01 and 2023-03-31
Steps to reproduce
My collection is presented :
Expected behaviour
It must return me an empty array.
Actual behaviour
It returns me all the table.