invoiceninja/app/Ninja/Transformers/InvoiceItemTransformer.php

26 lines
859 B
PHP
Raw Normal View History

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