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:
hamed
2026-06-18 15:03:36 +03:30
parent eb576b7d98
commit 4bb65c7502
5 changed files with 359 additions and 273 deletions
+7 -1
View File
@@ -252,8 +252,14 @@ class ClinicController extends BaseController
$filters = $request->query->all();
$result = $this->clinicRepo->findWithFilters($filters);
$clinicIds = array_map(fn(Clinic $c) => $c->getId(), $result['items']);
$locations = $this->clinicRepo->findAddressLocations($clinicIds);
return $this->paginated(
array_map(fn(Clinic $c) => $c->toListArray(), $result['items']),
array_map(function (Clinic $c) use ($locations) {
$loc = $locations[$c->getId()] ?? ['city' => null, 'state' => null];
return $c->toListArray($loc['city'], $loc['state']);
}, $result['items']),
$result['total'],
$result['page'],
$result['limit']