This commit is contained in:
Dr Masroor Ehsan 2025-01-03 21:39:29 +06:00
parent eec63fdc3b
commit 3651faeb4d

View File

@ -4,6 +4,7 @@
use App\Models\Enums\UserRole; use App\Models\Enums\UserRole;
use Exception; use Exception;
use Illuminate\Support\Facades\Cache;
final readonly class WorklistFactory final readonly class WorklistFactory
{ {
@ -12,7 +13,8 @@
*/ */
public static function getLister(): IUserStudyLister public static function getLister(): IUserStudyLister
{ {
$role = auth()->user()->roles()->first()->name; // $role = auth()->user()->roles()->first()->name;
$role = Cache::remember('user_role:'.auth()->id(), now()->addMinutes(5), fn () => auth()->user()->roles()->first()->name);
return match (UserRole::from($role)) { return match (UserRole::from($role)) {
UserRole::Admin => new AdminWorklist, UserRole::Admin => new AdminWorklist,