Add a source of currency exchange rates to scrape command.
All checks were successful
/ deploy-job (push) Successful in 1s

This commit is contained in:
2026-02-25 09:10:14 +01:00
parent ad0ef20fc2
commit 09825de7b9

View File

@@ -27,11 +27,13 @@ class ScrapeWebsite extends Command
public function __construct(protected Capsule $database)
{
parent::__construct();
$this->client = new Client();
$this->getCurrencyExchange();
die();
}
protected function configure(): void
{
$this->client = new Client();
$this->addOption(self::COUNTRY_ID, 'c', InputOption::VALUE_OPTIONAL, 'Country id');
}
@@ -147,4 +149,12 @@ class ScrapeWebsite extends Command
$productModel->stock()->save($stock);
}
}
public function getCurrencyExchange(): void {
$result = $this->client->request('GET', 'https://api.nbp.pl/api/exchangerates/tables/A/?format=json');
dd(json_decode($result->getBody()->getContents()));
}
}