add origin price.

This commit is contained in:
Edward Yang 2022-07-26 15:27:55 +08:00
parent 4b9c77a630
commit b8c21f66e5
1 changed files with 9 additions and 0 deletions

View File

@ -11,10 +11,18 @@
namespace Beike\Shop\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class ProductList extends JsonResource
{
/**
* 图片列表页Item
*
* @param Request $request
* @return array
* @throws \Exception
*/
public function toArray($request): array
{
return [
@ -22,6 +30,7 @@ class ProductList extends JsonResource
'name' => $this->description->name ?? '',
'url' => shop_route('products.show', ['product' => $this]),
'price' => $this->price,
'origin_price' => $this->origin_price,
'image' => image_resize($this->image),
'price_format' => currency_format($this->price),
'category_id' => $this->category_id ?? null,