I'm trying to create an array of dates. The idea is that I add a number x days and the code, when adding the days skip only Sunday.
This is for laravel and I'm using carbon.
$date = Carbon::now();
$dates = [];
for($i = 1 ; $i < 20; $i++){
if($date->dayOfWeek === Carbon::SATURDAY){
echo $dates[$i] = $date->addDay(1)->format('d/m/Y') . " - Sunday <br> ";
} else {
echo $dates[$i] = $date->addDay(1)->format('d/m/Y') . "<br>";
}
When i use the constant SUNDAY to skip this date, its not working. It goes on to consider Sunday as Monday