1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/Ninja/Transformers/InvoiceItemTransformer.php
2015-11-15 21:43:32 +11:00

28 lines
914 B
PHP

<?php namespace App\Ninja\Transformers;
use App\Models\Account;
use App\Models\InvoiceItem;
use League\Fractal;
class InvoiceItemTransformer extends EntityTransformer
{
public function transform(InvoiceItem $item)
{
return [
'id' => (int) $item->public_id,
'product_key' => $item->product_key,
'account_key' => $this->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
];
}
}