Spatie\Backup\Commands\CleanupCommand::handle PHP Method

handle() public method

public handle ( )
    public function handle()
    {
        consoleOutput()->comment('Starting cleanup...');
        try {
            $config = config('laravel-backup');
            $backupDestinations = BackupDestinationFactory::createFromArray($config['backup']);
            $strategy = app($config['cleanup']['strategy']);
            $cleanupJob = new CleanupJob($backupDestinations, $strategy);
            $cleanupJob->run();
            consoleOutput()->comment('Cleanup completed!');
        } catch (Exception $exception) {
            event(new CleanupHasFailed($exception));
            return -1;
        }
    }
CleanupCommand