<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class TransactionDetailResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        
        return [
            'stockCode' => $this->product_code,
            'description' => $this->product_name,
            'quantity' => $this->quantity,
            'unit_price' => (double) $this->price,
            'total' => (double) $this->amount
        ];
    }
}
