Files
YNWA Fawzy f037a936f3 Fixes:
- fix type when filtering product by price met target.
- fix the lowest price was overridden if price wasn't crawled.
- fix store tabs not working
- fix some european amazon using "." as thousands separator.
- keep last 3 days of logs only.
- added volume to .env to fix 2FA not working after restarting container
- added volume for database
-

New Stores:
- best buy

New Features:

- add other users to the system and manage their tokens.
- add telegram notification.
- add percentage drop.
- robot detection for amazon ( if the system was detected as robot, it will stop executing and try the next product, the same product that was blocked will be crawled again in the next batch)

Took 6 hours 50 minutes
2024-09-29 18:31:13 +04:00

41 lines
844 B
PHP

<?php
namespace App\Observers;
use App\Helpers\StoreHelper;
use App\Models\PriceHistory;
use App\Models\Product;
use App\Models\ProductStore;
class ProductObserver
{
/**
* Handle the Product "created" event.
*/
public function created(Product $product): void
{
StoreHelper::clear_caches_related_to_stores();
}
/**
* Handle the Product "updated" event.
*/
public function updated(Product $product): void
{
StoreHelper::clear_caches_related_to_stores();
}
/**
* Handle the Product "deleted" event.
*/
public function deleted(Product $product): void
{
ProductStore::where('product_id', $product->id)->delete();
PriceHistory::where('product_id', $product->id)->delete();
StoreHelper::clear_caches_related_to_stores();
}
}