Add a source of currency exchange rates to scrape command.
All checks were successful
/ deploy-job (push) Successful in 1s
All checks were successful
/ deploy-job (push) Successful in 1s
This commit is contained in:
@@ -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()));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user