mirror of
https://github.com/Cybrarist/Discount-Bandit.git
synced 2026-11-24 19:49:54 +01:00
- 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
41 lines
844 B
PHP
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();
|
|
}
|
|
|
|
}
|