1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00
invoiceninja/app/Ninja/Transformers/InvoiceItemTransformer.php

26 lines
859 B
PHP
Raw Normal View History

2015-11-03 15:21:17 +01:00
<?php namespace App\Ninja\Transformers;
2015-11-08 22:12:50 +01:00
use App\Models\Account;
2015-11-03 15:21:17 +01:00
use App\Models\InvoiceItem;
use League\Fractal;
2015-11-08 22:12:50 +01:00
class InvoiceItemTransformer extends EntityTransformer
2015-11-03 15:21:17 +01:00
{
public function transform(InvoiceItem $item)
{
return [
2015-11-15 11:43:32 +01:00
'id' => (int) $item->public_id,
2015-11-03 15:21:17 +01:00
'product_key' => $item->product_key,
2015-11-08 22:12:50 +01:00
'account_key' => $this->account->account_key,
2015-11-07 13:15:37 +01:00
'user_id' => (int) $item->user_id,
2015-12-27 12:08:58 +01:00
'updated_at' => $this->getTimestamp($item->updated_at),
'archived_at' => $this->getTimestamp($item->deleted_at),
2015-11-07 13:15:37 +01:00
'product_key' => $item->product_key,
'notes' => $item->notes,
'cost' => (float) $item->cost,
'qty' => (float) $item->qty,
'tax_name' => $item->tax_name,
'tax_rate' => (float) $item->tax_rate
2015-11-03 15:21:17 +01:00
];
}
}