/** * Execute the console command. * * @return mixed */ public function handle() { $from = date('Y-m-d H:i:s', strtotime($this->argument('from') ?: 'today')); $to = date('Y-m-d H:i:s', strtotime($this->argument('to') ?: 'now')); while ($images = Image::whereBetween('created_at', [$from, $to])->where('copy_count', '<', ImageStorage::count())->where('copy_count', '>', 0)->take(10)->get()) { if ($images->isEmpty()) { $this->info('No image to process.'); break; } foreach ($images as $image) { $image->checkMulti(); $this->info("Image:{$image->id} processed."); } } }