39 lines
690 B
PHP
39 lines
690 B
PHP
<?php
|
|
|
|
namespace App\Observers;
|
|
|
|
use App\Services\Admin\AdminPerformanceCache;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class AdminPerformanceCacheObserver
|
|
{
|
|
public function created(Model $model): void
|
|
{
|
|
$this->flush();
|
|
}
|
|
|
|
public function updated(Model $model): void
|
|
{
|
|
$this->flush();
|
|
}
|
|
|
|
public function deleted(Model $model): void
|
|
{
|
|
$this->flush();
|
|
}
|
|
|
|
public function restored(Model $model): void
|
|
{
|
|
$this->flush();
|
|
}
|
|
|
|
public function forceDeleted(Model $model): void
|
|
{
|
|
$this->flush();
|
|
}
|
|
|
|
private function flush(): void
|
|
{
|
|
app(AdminPerformanceCache::class)->flush();
|
|
}
|
|
}
|