Update
This commit is contained in:
@@ -6,6 +6,8 @@ use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use App\Models\Service;
|
||||
use App\Models\Organization;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DataListClaimMemberResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
@@ -16,12 +18,15 @@ class DataListClaimMemberResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$filesGroupByType = $this->files->mapToGroups(function($file) {
|
||||
return [Str::slug($file->type, '_') => $file];
|
||||
});
|
||||
$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 {
|
||||
@@ -43,6 +48,7 @@ class DataListClaimMemberResource extends JsonResource
|
||||
'provider_name' => $organizationName ?? null,
|
||||
'service_type' => $serviceName,
|
||||
'status' => $status,
|
||||
'files_by_type' => $filesGroupByType
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user