26 lines
655 B
PHP
26 lines
655 B
PHP
<?php
|
|
|
|
namespace App\DAL\Studies;
|
|
|
|
use App\Models\Enums\UserRole;
|
|
use Exception;
|
|
|
|
final readonly class WorklistFactory
|
|
{
|
|
/**
|
|
* @throws Exception
|
|
*/
|
|
public static function getLister(): IUserStudyLister
|
|
{
|
|
$role = auth()->user()->roles()->first()->name;
|
|
|
|
return match (UserRole::from($role)) {
|
|
UserRole::Admin => new AdminWorklist,
|
|
UserRole::Technician => new TechnicianWorklist,
|
|
UserRole::Radiologist => new RadiologistWorklist,
|
|
UserRole::ReferringDoctor => new ReferrerWorklist,
|
|
default => throw new Exception("Unknown user role: $role"),
|
|
};
|
|
}
|
|
}
|