added item taxes and totals to document api
This commit is contained in:
30
app/Transformers/Document/DocumentTotal.php
Normal file
30
app/Transformers/Document/DocumentTotal.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Transformers\Document;
|
||||
|
||||
use App\Models\Document\DocumentTotal as Model;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
|
||||
class DocumentTotal extends TransformerAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Model $model)
|
||||
{
|
||||
return [
|
||||
'id' => $model->id,
|
||||
'company_id' => $model->company_id,
|
||||
'type' => $model->type,
|
||||
'document_id' => $model->document_id,
|
||||
'code' => $model->code,
|
||||
'name' => $model->name,
|
||||
'amount' => $model->amount,
|
||||
'sort_order' => $model->sort_order,
|
||||
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : '',
|
||||
'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : '',
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user