2015-11-03 15:21:17 +01:00
|
|
|
<?php namespace App\Ninja\Transformers;
|
|
|
|
|
|
|
|
use App\Models\InvoiceItem;
|
|
|
|
use League\Fractal;
|
|
|
|
use League\Fractal\TransformerAbstract;
|
|
|
|
|
|
|
|
class InvoiceItemTransformer extends TransformerAbstract
|
|
|
|
{
|
|
|
|
public function transform(InvoiceItem $item)
|
|
|
|
{
|
|
|
|
return [
|
2015-11-07 13:15:37 +01:00
|
|
|
'public_id' => (int) $item->public_id,
|
2015-11-03 15:21:17 +01:00
|
|
|
'product_key' => $item->product_key,
|
2015-11-07 13:15:37 +01:00
|
|
|
'account_key' => $item->account->account_key,
|
|
|
|
'user_id' => (int) $item->user_id,
|
|
|
|
'invoice_id' => (int) $item->invoice_id,
|
|
|
|
'product_id' => (int) $item->product_id,
|
|
|
|
'updated_at' => $item->updated_at,
|
|
|
|
'deleted_at' => $item->deleted_at,
|
|
|
|
'product_key' => $item->product_key,
|
|
|
|
'notes' => $item->notes,
|
|
|
|
'cost' => (float) $item->cost,
|
|
|
|
'qty' => (float) $item->qty,
|
|
|
|
'tax_name' => $item->tax_name,
|
|
|
|
'tax_rate' => $item->tax_rate
|
2015-11-03 15:21:17 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|