Keep track of discontinued items. That means items that were tracked, but then they were never updated.Added is discontinued badge.

This commit is contained in:
Krzysztof Płaczek
2025-02-15 11:33:24 +01:00
parent 7eb7bf3eb2
commit 81f9c863c7
7 changed files with 52 additions and 9 deletions

View File

@@ -40,7 +40,6 @@ class ScrapeWebsite extends Command
$products = $this->getProducts();
$progress->setMaxSteps(count($products));
foreach ($products as $product) {
//dd($product);
$this->saveProduct($product);
$progress->advance();
}
@@ -91,6 +90,7 @@ class ScrapeWebsite extends Command
$productModel->variantCode = $product->variantCode;
$productModel->modelCode = $product->modelCode;
$productModel->url = $product->url;
$productModel->touch('updated_at');
$productModel->save();
$priceExists = $productModel->price()->whereRaw("strftime('%Y-%m-%d', created_at) = ?", [date('Y-m-d')])->exists();