tambah informasi provider
This commit is contained in:
@@ -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,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user