2019-04-02 07:16:39 +02:00
|
|
|
<?php
|
2019-05-11 05:32:07 +02:00
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
2019-04-02 07:16:39 +02:00
|
|
|
|
|
|
|
namespace App\Transformers;
|
|
|
|
|
|
|
|
class InvoiceItemTransformer extends EntityTransformer
|
|
|
|
{
|
2019-08-26 10:25:05 +02:00
|
|
|
|
2019-04-02 07:16:39 +02:00
|
|
|
public function transform($item)
|
|
|
|
{
|
|
|
|
return [
|
2019-04-03 02:09:22 +02:00
|
|
|
'id' => (int) $item->id,
|
2019-04-02 07:16:39 +02:00
|
|
|
'product_key' => $item->product_key,
|
|
|
|
'updated_at' => $item->updated_at,
|
|
|
|
'archived_at' => $item->deleted_at,
|
2019-09-27 00:14:02 +02:00
|
|
|
'notes' => $item->notes ?: '',
|
|
|
|
'cost' => (float) $item->cost ?: '',
|
2019-09-04 01:16:23 +02:00
|
|
|
'quantity' => (float) ($item->quantity ?: 0.0),
|
2019-04-02 07:16:39 +02:00
|
|
|
'tax_name1' => $item->tax_name1 ? $item->tax_name1 : '',
|
|
|
|
'tax_rate1' => (float) ($item->tax_rate1 ?: 0.0),
|
|
|
|
'tax_name2' => $item->tax_name2 ? $item->tax_name2 : '',
|
|
|
|
'tax_rate2' => (float) ($item->tax_rate2 ?: 0.0),
|
2019-09-27 00:14:02 +02:00
|
|
|
'invoice_item_type_id' => (string) $item->invoice_item_type_id ?: '',
|
2019-04-02 07:16:39 +02:00
|
|
|
'custom_value1' => $item->custom_value1 ?: '',
|
|
|
|
'custom_value2' => $item->custom_value2 ?: '',
|
2019-09-27 00:14:02 +02:00
|
|
|
'discount' => (float) $item->discount ?: '',
|
2019-04-02 07:16:39 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|