added currency transformer to incomes/expenses api

This commit is contained in:
denisdulici
2018-02-09 16:18:56 +03:00
parent dc9b33a68f
commit e97731eed9
9 changed files with 144 additions and 64 deletions

View File

@ -3,6 +3,7 @@
namespace App\Transformers\Income;
use App\Transformers\Banking\Account;
use App\Transformers\Setting\Currency;
use App\Models\Income\InvoicePayment as Model;
use League\Fractal\TransformerAbstract;
@ -11,7 +12,7 @@ class InvoicePayments extends TransformerAbstract
/**
* @var array
*/
protected $defaultIncludes = ['account'];
protected $defaultIncludes = ['account', 'currency'];
/**
* @param Model $model
@ -45,4 +46,13 @@ class InvoicePayments extends TransformerAbstract
{
return $this->item($model->account, new Account());
}
/**
* @param Model $model
* @return mixed
*/
public function includeCurrency(Model $model)
{
return $this->item($model->currency, new Currency());
}
}