diff --git a/src/Command/ScrapeWebsite.php b/src/Command/ScrapeWebsite.php index 1860ade..78315e9 100644 --- a/src/Command/ScrapeWebsite.php +++ b/src/Command/ScrapeWebsite.php @@ -3,6 +3,7 @@ declare(strict_types=1); namespace Krzysiej\RyobiCrawler\Command; + use GuzzleHttp\Client; use Illuminate\Database\Capsule\Manager as Capsule; use Krzysiej\RyobiCrawler\Models\Price; @@ -23,7 +24,7 @@ class ScrapeWebsite extends Command $capsule = new Capsule; $capsule->addConnection([ 'driver' => 'sqlite', - 'database' => __DIR__ .'/../../database.sqlite', + 'database' => __DIR__ . '/../../database.sqlite', ]); $capsule->setAsGlobal(); $capsule->bootEloquent(); @@ -37,7 +38,6 @@ class ScrapeWebsite extends Command $page = 0; do { $progress->advance(); - $res = $this->client->request('POST', 'https://pl.ryobitools.eu/api/product-listing/get-products', [ 'form_params' => [ "includePreviousPages" => false, @@ -49,7 +49,7 @@ class ScrapeWebsite extends Command $page++; $responseObject = json_decode($res->getBody()->getContents()); $products = $responseObject->products; - $progress->setMaxSteps($progress->getMaxSteps()+count($products)); + $progress->setMaxSteps($progress->getMaxSteps() + count($products)); foreach ($products as $product) { /** @var Product $productModel */ $productModel = Product::firstOrNew(['skuID' => $product->skuID]); @@ -78,7 +78,6 @@ class ScrapeWebsite extends Command $progress->finish(); $output->writeln(''); $output->writeln('DONE'); - return Command::SUCCESS; } } \ No newline at end of file