25 lines
599 B
PHP
25 lines
599 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Console\Commands;
|
||
|
|
|
||
|
|
use App\Models\Tool;
|
||
|
|
use Illuminate\Console\Command;
|
||
|
|
|
||
|
|
class MirrorToolLogos extends Command
|
||
|
|
{
|
||
|
|
protected $signature = 'tools:mirror-logos';
|
||
|
|
|
||
|
|
protected $description = 'Queue jobs to download externally-hosted tool logos and serve them from local storage';
|
||
|
|
|
||
|
|
public function handle(): int
|
||
|
|
{
|
||
|
|
$tools = Tool::query()->whereNotNull('logo_url')->get()->reject->hasLocalLogo();
|
||
|
|
|
||
|
|
$tools->each->queueLogoMirrorIfNeeded();
|
||
|
|
|
||
|
|
$this->info("Queued {$tools->count()} tool logo(s) for mirroring.");
|
||
|
|
|
||
|
|
return self::SUCCESS;
|
||
|
|
}
|
||
|
|
}
|