1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 14:12:44 +01:00
invoiceninja/app/Ninja/Transformers/InvoiceItemTransformer.php

28 lines
939 B
PHP
Raw Normal View History

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
];
}
}