feat(appointment): include doctor specialties and clinic address in toArray
The appointment detail view needs the doctor's specialty and the clinic address/phone/map, which toArray didn't return. Add doctor.specialties[] and a top-level `address` (the doctor's first address via DoctorAddress::toArray — address, telephone, map). Additive only; existing keys unchanged. Docs updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -153,12 +153,19 @@ class Appointment
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
$firstAddress = $this->doctor->getAddresses()->first() ?: null;
|
||||
|
||||
return [
|
||||
'uuid' => $this->uuid,
|
||||
'doctor' => [
|
||||
'uuid' => $this->doctor->getUuid(),
|
||||
'name' => $this->doctor->getName(),
|
||||
'uuid' => $this->doctor->getUuid(),
|
||||
'name' => $this->doctor->getName(),
|
||||
'specialties' => array_map(
|
||||
fn($s) => ['uuid' => $s->getUuid(), 'name' => $s->getName()],
|
||||
$this->doctor->getSpecialties()->toArray()
|
||||
),
|
||||
],
|
||||
'address' => $firstAddress?->toArray(),
|
||||
'user' => [
|
||||
'uuid' => $this->user->getUuid(),
|
||||
'mobile' => $this->user->getMobileNumber(),
|
||||
|
||||
Reference in New Issue
Block a user