| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace App\Http\Resources;
- use Illuminate\Http\Request;
- use Illuminate\Http\Resources\Json\JsonResource;
- class AddressResource extends JsonResource
- {
- /**
- * Transform the resource into an array.
- *
- * @return array<string, mixed>
- */
- public function toArray(Request $request): array
- {
- return [
- 'id' => $this->id,
- 'source' => $this->source,
- 'source_id' => $this->source_id,
- 'zip_code' => $this->zip_code,
- 'address' => $this->address,
- 'has_complement' => $this->has_complement,
- 'complement' => $this->complement,
- 'nickname' => $this->nickname,
- 'instructions' => $this->instructions,
- 'city_id' => $this->city_id,
- 'state_id' => $this->state_id,
- 'city' => $this->whenLoaded('city'),
- 'state' => $this->whenLoaded('state'),
- 'address_type' => $this->address_type,
- 'created_at' => $this->created_at,
- 'updated_at' => $this->updated_at,
- 'deleted_at' => $this->deleted_at,
- ];
- }
- }
|