adding UserDetailObserver and reorderable records feature

This commit is contained in:
F4ilji
2025-05-13 15:01:03 +05:00
parent c3c468c11a
commit 0314febda2
14 changed files with 165 additions and 273 deletions
@@ -0,0 +1,56 @@
<?php
namespace App\Containers\User\Observers;
use App\Containers\User\Models\UserDetail;
use App\Services\App\Cache\UserCacheService;
class UserDetailObserver
{
private UserCacheService $userCacheService;
public function __construct()
{
$this->userCacheService = app(UserCacheService::class);
}
/**
* Handle the User "created" event.
*/
public function created(UserDetail $user): void
{
$this->userCacheService->clearAllCacheByModel();
}
/**
* Handle the User "updated" event.
*/
public function updated(UserDetail $user): void
{
$this->userCacheService->clearAllCacheByModel();
}
/**
* Handle the User "deleted" event.
*/
public function deleted(UserDetail $user): void
{
$this->userCacheService->clearAllCacheByModel();
}
/**
* Handle the User "restored" event.
*/
public function restored(UserDetail $user): void
{
$this->userCacheService->clearAllCacheByModel();
}
/**
* Handle the User "force deleted" event.
*/
public function forceDeleted(UserDetail $user): void
{
$this->userCacheService->clearAllCacheByModel();
}
}