You can create a for loop like the one below and loop over Carbon subtracting the date based on the current iteration. This will add each of the days into a$day variable, but you can mix this up as needed.
for ($i = 1; $i < 7; $i++) {
$day[] = Carbon::now()->subDays($i)->format('D');
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community