where('created_at', '<', now()->subHours(2)->toDateTimeString()) ->take($limit) ->get(); $bar = $this->output->createProgressBar($gc->count()); $bar->start(); foreach($gc as $media) { MediaStorageService::delete($media, true); $bar->advance(); } $bar->finish(); $this->line(''); } }