1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-22 01:11:34 +02:00
invoiceninja/app/Ninja/Import/Hiveage/PaymentTransformer.php

30 lines
641 B
PHP
Raw Normal View History

2017-01-30 20:40:43 +01:00
<?php
namespace App\Ninja\Import\Hiveage;
2015-12-08 11:10:20 +01:00
use App\Ninja\Import\BaseTransformer;
use League\Fractal\Resource\Item;
/**
2017-01-30 20:40:43 +01:00
* Class PaymentTransformer.
*/
2015-12-08 11:10:20 +01:00
class PaymentTransformer extends BaseTransformer
{
/**
* @param $data
2017-01-30 20:40:43 +01:00
*
* @return Item
*/
2016-06-02 21:03:59 +02:00
public function transform($data)
2015-12-08 11:10:20 +01:00
{
2016-06-02 21:03:59 +02:00
return new Item($data, function ($data) {
2015-12-08 11:10:20 +01:00
return [
'amount' => $data->paid_total,
2017-01-15 20:48:31 +01:00
'payment_date_sql' => $this->getDate($data, 'last_paid_on'),
2015-12-08 11:10:20 +01:00
'client_id' => $data->client_id,
'invoice_id' => $data->invoice_id,
2015-12-08 11:10:20 +01:00
];
});
}
2016-06-02 21:03:59 +02:00
}