Support the ongoing development of Laravel.io →
posted 7 years ago
Views Blade
Last updated 2 years ago.
0

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');
}
0

Sign in to participate in this thread!

Eventy

Your banner here too?

saurabh saurabh Joined 13 Apr 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.