Files
wticreatorstudio/Modules/StaffPayroll/Transformers/InvoiceItemResource.php
T

37 lines
1.1 KiB
PHP

<?php
namespace Modules\StaffPayroll\Transformers;
use Illuminate\Http\Resources\Json\JsonResource;
class InvoiceItemResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
// return parent::toArray($request);
return [
'id' => $this->id,
'invoice' => $this->whenLoaded('invoice'),
'studio_plus_incentive_id' => $this->studio_plus_incentive_id,
'studio_plus_video_id' => $this->studio_plus_video_id,
'incentive' => $this->whenLoaded('incentive'),
'item_no' => $this->item_no,
'name' => $this->name,
'description' => $this->description,
'issue_date' => $this->issue_date,
'created_date' => $this->created_at,
'amount' => $this->amount,
'range_amount' => $this->range_amount,
'quantity' => $this->quantity,
'total' => $this->amount * $this->quantity,
'type' => $this->type,
];
}
}