mirror of
https://github.com/Cybrarist/Discount-Bandit.git
synced 2026-11-24 19:49:54 +01:00
- groups and groups price history Fixes: - some env are not reflecting Took 2 hours 10 minutes
33 lines
629 B
PHP
33 lines
629 B
PHP
<?php
|
|
|
|
namespace App\Observers;
|
|
|
|
use App\Jobs\CheckGroupPriceJob;
|
|
use App\Models\Group;
|
|
use App\Models\GroupPriceHistory;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class GroupObserver
|
|
{
|
|
/**
|
|
* Handle the Group "created" event.
|
|
*/
|
|
public function saved(Group $group): void
|
|
{
|
|
CheckGroupPriceJob::dispatch();
|
|
}
|
|
|
|
/**
|
|
* Handle the Group "deleted" event.
|
|
*/
|
|
public function deleting(Group $group): void
|
|
{
|
|
DB::table('group_product')
|
|
->where('group_id', $group->id)
|
|
->delete();
|
|
|
|
GroupPriceHistory::where('group_id', $group->id)->delete();
|
|
}
|
|
|
|
}
|