Rework admin panel and other

This commit is contained in:
F4ilji
2025-04-02 18:37:20 +05:00
parent 49072e50c7
commit 5cd6ff11b5
198 changed files with 9715 additions and 6664 deletions
+59
View File
@@ -0,0 +1,59 @@
<?php
namespace App\Observers;
use App\Models\Department;
use App\Services\App\Cache\DepartmentCacheService;
class DepartmentObserver
{
private DepartmentCacheService $departmentCacheService;
public function __construct()
{
$this->departmentCacheService = app(DepartmentCacheService::class);
}
/**
* Handle the Department "created" event.
*/
public function created(Department $department): void
{
$this->departmentCacheService->clearAllCacheByModel();
}
/**
* Handle the Department "updated" event.
*/
public function updated(Department $department): void
{
$this->departmentCacheService->clearCache($department);
$this->departmentCacheService->clearAllCacheByModel(); // Очищаем и общий кэш, если есть списки
}
/**
* Handle the Department "deleted" event.
*/
public function deleted(Department $department): void
{
$this->departmentCacheService->clearCache($department);
$this->departmentCacheService->clearAllCacheByModel();
}
/**
* Handle the Department "restored" event.
*/
public function restored(Department $department): void
{
$this->departmentCacheService->clearAllCacheByModel();
}
/**
* Handle the Department "force deleted" event.
*/
public function forceDeleted(Department $department): void
{
$this->departmentCacheService->clearCache($department);
$this->departmentCacheService->clearAllCacheByModel();
}
}