where('interval', $this->argument('interval')) ->where('status', BackupStatus::RUNNING) ->chunk(100, function ($backups) use (&$total) { /** @var Backup $backup */ foreach ($backups as $backup) { app(RunBackup::class)->run($backup); $total++; } }); $this->info("{$total} backups started"); } }