34 lines
826 B
PHP
34 lines
826 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Data\UserAddressResponseDTO;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
/**
|
|
* @property UserAddressResponseDTO $resource
|
|
*/
|
|
class AddressResource extends JsonResource
|
|
{
|
|
public static $wrap = null;
|
|
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->resource->id,
|
|
'firstName' => $this->resource->firstName,
|
|
'lastName' => $this->resource->lastName,
|
|
'street' => $this->resource->street,
|
|
'city' => $this->resource->city,
|
|
'state' => $this->resource->state,
|
|
'pinCode' => $this->resource->pinCode,
|
|
];
|
|
}
|
|
}
|