Spatie\Backup\Tasks\Cleanup\Period::endDate PHP Method

endDate() public method

public endDate ( ) : Carbon\Carbon
return Carbon\Carbon
    public function endDate() : Carbon
    {
        return $this->endDate->copy();
    }

Usage Example

 protected function calculateDateRanges() : Collection
 {
     $config = $this->config->get('laravel-backup.cleanup.defaultStrategy');
     $daily = new Period(Carbon::now()->subDays($config['keepAllBackupsForDays']), Carbon::now()->subDays($config['keepAllBackupsForDays'])->subDays($config['keepDailyBackupsForDays']));
     $weekly = new Period($daily->endDate(), $daily->endDate()->subWeeks($config['keepWeeklyBackupsForWeeks']));
     $monthly = new Period($weekly->endDate(), $weekly->endDate()->subMonths($config['keepMonthlyBackupsForMonths']));
     $yearly = new Period($monthly->endDate(), $monthly->endDate()->subYears($config['keepYearlyBackupsForYears']));
     return collect(compact('daily', 'weekly', 'monthly', 'yearly'));
 }