feat(clinic): enhance clinic listing with additional details and address information
- Updated the clinic API response to include new fields: title, phone, logo, images_clinic, doctors_count, city, state, 24_7, and field_working_days. - Modified the ClinicController to fetch and include city and state information based on the clinic's address. - Refactored the toListArray method in the Clinic entity to accept city and state parameters. - Added a new method in the ClinicRepository to retrieve city and province names for each clinic based on their address.
This commit is contained in:
@@ -211,7 +211,7 @@ class Clinic
|
||||
];
|
||||
}
|
||||
|
||||
public function toListArray(): array
|
||||
public function toListArray(?string $city = null, ?string $state = null): array
|
||||
{
|
||||
return [
|
||||
'id' => (string) $this->id,
|
||||
@@ -226,10 +226,13 @@ class Clinic
|
||||
'doctors_count' => $this->doctors->count(),
|
||||
'is_active' => $this->isActive,
|
||||
'created_at' => $this->createdAt,
|
||||
'city' => $city,
|
||||
'state' => $state,
|
||||
'specialties' => array_map(fn(Specialty $s) => [
|
||||
'uuid' => $s->getUuid(), 'id' => (string) $s->getId(), 'name' => $s->getName(),
|
||||
], $this->specialties->toArray()),
|
||||
'24_7' => $this->is247,
|
||||
'24_7' => $this->is247,
|
||||
'field_working_days' => $this->workingDays,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user