28 lines
719 B
PHP
28 lines
719 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Services\ZaarboxPriceService;
|
|
use Illuminate\Console\Command;
|
|
|
|
class RefreshZaarboxPrices extends Command
|
|
{
|
|
protected $signature = 'prices:refresh-zaarbox';
|
|
|
|
protected $description = 'Fetch gold price history from Zaarbox and store in cache';
|
|
|
|
public function handle(ZaarboxPriceService $zaarboxPriceService): int
|
|
{
|
|
$prices = $zaarboxPriceService->refreshCache();
|
|
|
|
$this->info(sprintf(
|
|
'Zaarbox prices cached: DAILY=%d, WEEKLY=%d, MONTHLY=%d',
|
|
count($prices['DAILY'] ?? []),
|
|
count($prices['WEEKLY'] ?? []),
|
|
count($prices['MONTHLY'] ?? []),
|
|
));
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|