Add properties filtering and relationships in Product model
This commit is contained in:
32
app/Observers/ProductAttributeValueObserver.php
Normal file
32
app/Observers/ProductAttributeValueObserver.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Models\Ecommerce\Product\Property\ProductAttributeValue;
|
||||
|
||||
class ProductAttributeValueObserver
|
||||
{
|
||||
/**
|
||||
* Handle the ProductAttributeValue "created" event.
|
||||
*/
|
||||
public function created(ProductAttributeValue $productAttributeValue): void
|
||||
{
|
||||
$productAttributeValue->productProperty->product->syncPropertiesJson();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the ProductAttributeValue "updated" event.
|
||||
*/
|
||||
public function updated(ProductAttributeValue $productAttributeValue): void
|
||||
{
|
||||
$productAttributeValue->productProperty->product->syncPropertiesJson();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the ProductAttributeValue "deleted" event.
|
||||
*/
|
||||
public function deleted(ProductAttributeValue $productAttributeValue): void
|
||||
{
|
||||
$productAttributeValue->productProperty->product->syncPropertiesJson();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user