-
app/Console/Commands/UpdateLinkThumbnails.php
Open in GitHubuse App\Models\Link; use Illuminate\Console\Command; class UpdateLinkThumbnails extends Command { // public function handle(): void { // Link::where('status', Link::STATUS_OK)->latest() ->chunk(100, function ($links) use ($processedLinks, $totalCount) { foreach ($links as $link) { $this->updateThumbnailForLink($link); sleep(1); // Rate limiting of outgoing traffic } $processedLinks += count($links); $this->comment("Processed $processedLinks of $totalCount links."); }); // } // }