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