26 lines
649 B
PHP
26 lines
649 B
PHP
<?php
|
|
|
|
namespace App\Api\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class GoodsListResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'title' => $this->title,
|
|
'img' => $this->storage_id ? $this->storage ? 'http://www.bohaimingpin.com' . $this->storage->path : '' : '',
|
|
'price' => $this->min_price,
|
|
'description' => mb_substr($this->description, 0, 60)
|
|
];
|
|
}
|
|
}
|