Skip to content

Instantly share code, notes, and snippets.

@martanto
Last active March 30, 2020 01:46
Show Gist options
  • Save martanto/766a6b1536afdc5b54e35d8802877c2d to your computer and use it in GitHub Desktop.
Save martanto/766a6b1536afdc5b54e35d8802877c2d to your computer and use it in GitHub Desktop.
using times() method to create a list of next 7 days using the Carbon instance
<?php
use Illuminate\Support\Collection;
$nextWeek = Collection::times(7, function ($index) {
return \Carbon\Carbon::now()->addDay($index);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment