32 lines
691 B
PHP
32 lines
691 B
PHP
<?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 GoodsParamsResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'value' => $this->value,
|
|
'price' =>number_format($this->price - $this->score,2),
|
|
'score' =>number_format($this->score,2),
|
|
'stock' =>$this->stock,
|
|
'checked'=>false,
|
|
];
|
|
}
|
|
}
|