Api endpoint added money format.

This commit is contained in:
Cüneyt Şentürk
2021-06-22 17:44:38 +03:00
parent e22c6f5e1f
commit f1e5ec5229
9 changed files with 12 additions and 0 deletions

View File

@ -31,6 +31,7 @@ class Document extends TransformerAbstract
'issued_at' => $model->issued_at ? $model->issued_at->toIso8601String() : '',
'due_at' => $model->due_at ? $model->due_at->toIso8601String() : '',
'amount' => $model->amount,
'amount_format' => money($model->amount, $model->currency_code, true)->format(),
'currency_code' => $model->currency_code,
'currency_rate' => $model->currency_rate,
'contact_id' => $model->contact_id,

View File

@ -21,7 +21,9 @@ class DocumentItem extends TransformerAbstract
'item_id' => $model->item_id,
'name' => $model->name,
'price' => $model->price,
'price_format' => money($model->price, $model->document->currency_code, true)->format(),
'total' => $model->total,
'total_format' => money($model->total, $model->document->currency_code, true)->format(),
'tax' => $model->tax,
'tax_id' => $model->tax_id,
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',

View File

@ -28,6 +28,7 @@ class DocumentItemTax extends TransformerAbstract
'tax_id' => $model->tax_id,
'name' => $model->name,
'amount' => $model->amount,
'amount_format' => money($model->amount, $model->document->currency_code, true)->format(),
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '',
];

View File

@ -22,6 +22,7 @@ class DocumentTotal extends TransformerAbstract
'code' => $model->code,
'name' => $model->name,
'amount' => $model->amount,
'amount_format' => money($model->amount, $model->document->currency_code, true)->format(),
'sort_order' => $model->sort_order,
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '',