更新代码
This commit is contained in:
38
app/Api/Resources/AddressResource.php
Normal file
38
app/Api/Resources/AddressResource.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: sunny
|
||||
* Date: 2019/1/30
|
||||
* Time: 4:25 PM
|
||||
*/
|
||||
|
||||
namespace App\Api\Resources;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class AddressResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* 小程序,编辑收货地址时返回的数据
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'address' => $this->getAddress(),
|
||||
'addressBrief'=>$this->address,
|
||||
'name' =>$this->name,
|
||||
'mobile' =>$this->mobile,
|
||||
'is_default' =>$this->is_default,
|
||||
'province_sn'=>$this->province_sn,
|
||||
'city_sn'=>$this->city_sn,
|
||||
'area_sn'=>$this->area_sn,
|
||||
'province_name'=>$this->area->province,
|
||||
'city_name'=>$this->area->city,
|
||||
'area_name'=>$this->area->area,
|
||||
'full_region'=>$this->area->province. '-' .$this->area->city. '-' .$this->area->area,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user