1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 23:22:52 +01:00
invoiceninja/app/Ninja/Transformers/CreditTransformer.php

28 lines
851 B
PHP
Raw Normal View History

2016-02-03 04:21:13 +01:00
<?php namespace App\Ninja\Transformers;
use App\Models\Credit;
/**
* Class CreditTransformer
*/
2016-02-03 04:21:13 +01:00
class CreditTransformer extends EntityTransformer
{
/**
* @param Credit $credit
* @return array
*/
2016-02-03 04:21:13 +01:00
public function transform(Credit $credit)
{
2016-05-03 22:02:29 +02:00
return array_merge($this->getDefaults($credit), [
2016-02-03 04:21:13 +01:00
'id' => (int) $credit->public_id,
'amount' => (float) $credit->amount,
'balance' => (float) $credit->balance,
'updated_at' => $this->getTimestamp($credit->updated_at),
'archived_at' => $this->getTimestamp($credit->deleted_at),
'is_deleted' => (bool) $credit->is_deleted,
'credit_date' => $credit->credit_date,
'credit_number' => $credit->credit_number,
'private_notes' => $credit->private_notes,
2016-05-03 22:02:29 +02:00
]);
2016-02-03 04:21:13 +01:00
}
}