invoiceninja/app/Ninja/Import/Invoiceable/PaymentTransformer.php

30 lines
618 B
PHP
Raw Permalink Normal View History

2017-01-30 21:40:43 +02:00
<?php
namespace App\Ninja\Import\Invoiceable;
2015-12-10 12:57:51 +02:00
use App\Ninja\Import\BaseTransformer;
use League\Fractal\Resource\Item;
/**
2017-01-30 21:40:43 +02:00
* Class PaymentTransformer.
*/
2015-12-10 12:57:51 +02:00
class PaymentTransformer extends BaseTransformer
{
/**
* @param $data
2017-01-30 21:40:43 +02:00
*
* @return Item
*/
2016-06-02 22:03:59 +03:00
public function transform($data)
2015-12-10 12:57:51 +02:00
{
2016-06-02 22:03:59 +03:00
return new Item($data, function ($data) {
2015-12-10 12:57:51 +02:00
return [
'amount' => $data->paid,
'payment_date_sql' => $data->date_paid,
'client_id' => $data->client_id,
'invoice_id' => $data->invoice_id,
2015-12-10 12:57:51 +02:00
];
});
}
2016-06-02 22:03:59 +03:00
}