2017-01-30 20:40:43 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Ninja\Transformers;
|
2015-11-03 15:21:17 +01:00
|
|
|
|
|
|
|
use App\Models\InvoiceItem;
|
|
|
|
|
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)
|
|
|
|
{
|
2016-05-03 22:02:29 +02:00
|
|
|
return array_merge($this->getDefaults($item), [
|
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-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
|
|
|
'notes' => $item->notes,
|
|
|
|
'cost' => (float) $item->cost,
|
|
|
|
'qty' => (float) $item->qty,
|
2016-04-08 13:25:06 +02:00
|
|
|
'tax_name1' => $item->tax_name1 ? $item->tax_name1 : '',
|
2016-03-31 11:29:01 +02:00
|
|
|
'tax_rate1' => (float) $item->tax_rate1,
|
2016-07-15 23:52:00 +02:00
|
|
|
'tax_name2' => $item->tax_name2 ? $item->tax_name2 : '',
|
2016-03-31 11:29:01 +02:00
|
|
|
'tax_rate2' => (float) $item->tax_rate2,
|
2017-03-26 11:55:47 +02:00
|
|
|
'invoice_item_type_id' => (int) $item->invoice_item_type_id,
|
2016-05-03 22:02:29 +02:00
|
|
|
]);
|
2015-11-03 15:21:17 +01:00
|
|
|
}
|
2016-07-15 23:52:00 +02:00
|
|
|
}
|