onQueue($queue); } } public function handle(): void { $batch = max(1, min($this->batchSize, 1000)); $artworks = Artwork::query() ->where('id', '>', $this->afterId) ->whereNotNull('hash') ->orderBy('id') ->limit($batch) ->get(['id', 'hash']); if ($artworks->isEmpty()) { return; } foreach ($artworks as $artwork) { GenerateArtworkEmbeddingJob::dispatch((int) $artwork->id, (string) $artwork->hash, $this->force); } if ($artworks->count() === $batch) { $lastId = (int) $artworks->last()->id; self::dispatch($lastId, $batch, $this->force); } } }