/** * Execute the console command. * * @return mixed * @throws Exception */ public function handle() { $user = User::findOrFail($this->argument('userId')); if ($this->option('regenerate')) { $albums = $user->albums; } else { $albums = $user->albums()->whereNull('thumbnailImageFileId')->get(); } foreach ($albums as $album) { \Queue::connection('sync')->push(new MakeAlbumThumbnailJob($album)); } }