37 lines
888 B
PHP
37 lines
888 B
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: sunny
|
|
* Date: 2019/2/11
|
|
* Time: 4:01 PM
|
|
*/
|
|
|
|
namespace App\Api\Resources;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class CartResource extends JsonResource
|
|
{
|
|
/**
|
|
* 小程序,购物车列表页返回数据
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'cart_id' => $this->id,
|
|
'user_id' => $this->user_id,
|
|
'pic_url' => 'http://www.bohaimingpin.com'.$this->params->storage->path ,
|
|
'title' => $this->params->goods->title,
|
|
'value' => $this->params->value,
|
|
'price'=>$this->params->price,
|
|
'score'=>$this->params->score,
|
|
'stock'=>$this->params->stock,
|
|
'number'=>$this->number,
|
|
'state'=>true,
|
|
|
|
];
|
|
}
|
|
}
|