sarga/packages/Webkul/API/Http/Resources/Customer/Customer.php

32 lines
973 B
PHP
Raw Normal View History

2019-03-13 11:17:52 +00:00
<?php
namespace Webkul\API\Http\Resources\Customer;
use Illuminate\Http\Resources\Json\JsonResource;
class Customer extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
return [
2020-02-19 11:24:04 +00:00
'id' => $this->id,
'email' => $this->email,
'first_name' => $this->first_name,
'last_name' => $this->last_name,
'name' => $this->name,
'gender' => $this->gender,
2019-03-13 11:17:52 +00:00
'date_of_birth' => $this->date_of_birth,
2020-02-19 11:24:04 +00:00
'phone' => $this->phone,
'status' => $this->status,
'group' => $this->when($this->customer_group_id, new CustomerGroup($this->group)),
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
2019-03-13 11:17:52 +00:00
];
}
}