tambah informasi provider

This commit is contained in:
2024-02-15 12:26:48 +07:00
parent 14949a47f9
commit f37657b154
5 changed files with 63 additions and 30 deletions

View File

@@ -4,6 +4,7 @@ namespace Modules\Client\Transformers\AlarmCenter;
use Illuminate\Http\Resources\Json\JsonResource;
use App\Models\Service;
use App\Models\Organization;
class DataListClaimMemberResource extends JsonResource
{
@@ -16,10 +17,15 @@ class DataListClaimMemberResource extends JsonResource
public function toArray($request)
{
$serviceData = Service::where('code', $this->service_code)->first();
$organization = Organization::where('id', $this->organization_id)->first();
$organizationName = '-';
if ($organization){
$organizationName = $organization->name;
}
if ($serviceData) {
$serviceName = $serviceData->name;
} else {
$serviceName = $this->service_cod;
$serviceName = $this->service_code;
}
if ($this->status == 'approved' && $this->status_final_log ){
@@ -34,6 +40,7 @@ class DataListClaimMemberResource extends JsonResource
'admission_date' => $this->submission_date ?? null,
'discharge_date' => $this->discharge_date ?? null,
'code' => $this->code ?? null,
'provider_name' => $organizationName ?? null,
'service_type' => $serviceName,
'status' => $status,
];