2015-12-07 22:41:48 +01:00
|
|
|
<?php namespace App\Ninja\Import\Harvest;
|
|
|
|
|
2015-12-08 11:10:20 +01:00
|
|
|
use App\Ninja\Import\BaseTransformer;
|
2015-12-07 22:41:48 +01:00
|
|
|
use League\Fractal\Resource\Item;
|
|
|
|
|
2016-07-03 18:11:58 +02:00
|
|
|
/**
|
|
|
|
* Class PaymentTransformer
|
|
|
|
*/
|
2015-12-08 11:10:20 +01:00
|
|
|
class PaymentTransformer extends BaseTransformer
|
2015-12-07 22:41:48 +01:00
|
|
|
{
|
2016-07-03 18:11:58 +02:00
|
|
|
/**
|
|
|
|
* @param $data
|
|
|
|
* @return Item
|
|
|
|
*/
|
2015-12-08 11:10:20 +01:00
|
|
|
public function transform($data)
|
2015-12-07 22:41:48 +01:00
|
|
|
{
|
2015-12-08 11:10:20 +01:00
|
|
|
return new Item($data, function ($data) {
|
2015-12-07 22:41:48 +01:00
|
|
|
return [
|
|
|
|
'amount' => $data->paid_amount,
|
2015-12-08 11:10:20 +01:00
|
|
|
'payment_date_sql' => $this->getDate($data->last_payment_date, 'm/d/Y'),
|
2015-12-07 22:41:48 +01:00
|
|
|
'client_id' => $data->client_id,
|
2015-12-31 15:14:30 +01:00
|
|
|
'invoice_id' => $data->invoice_id,
|
2015-12-07 22:41:48 +01:00
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|