Add category object and category_id to document resource
The endpoint api/documents don't return the category of invoice/bill as the endpoint api/transactions do. With this change will be possible return this value. Signed-off-by: Vitor Mattos <vitor@php.rio>
This commit is contained in:
parent
1a2c7116e5
commit
b1f5be1d90
@ -8,6 +8,7 @@ use App\Http\Resources\Document\DocumentHistory;
|
|||||||
use App\Http\Resources\Document\DocumentItem;
|
use App\Http\Resources\Document\DocumentItem;
|
||||||
use App\Http\Resources\Document\DocumentItemTax;
|
use App\Http\Resources\Document\DocumentItemTax;
|
||||||
use App\Http\Resources\Document\DocumentTotal;
|
use App\Http\Resources\Document\DocumentTotal;
|
||||||
|
use App\Http\Resources\Setting\Category;
|
||||||
use App\Http\Resources\Setting\Currency;
|
use App\Http\Resources\Setting\Currency;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ class Document extends JsonResource
|
|||||||
'due_at' => $this->due_at ? $this->due_at->toIso8601String() : '',
|
'due_at' => $this->due_at ? $this->due_at->toIso8601String() : '',
|
||||||
'amount' => $this->amount,
|
'amount' => $this->amount,
|
||||||
'amount_formatted' => money($this->amount, $this->currency_code, true)->format(),
|
'amount_formatted' => money($this->amount, $this->currency_code, true)->format(),
|
||||||
|
'category_id' => $this->category_id,
|
||||||
'currency_code' => $this->currency_code,
|
'currency_code' => $this->currency_code,
|
||||||
'currency_rate' => $this->currency_rate,
|
'currency_rate' => $this->currency_rate,
|
||||||
'contact_id' => $this->contact_id,
|
'contact_id' => $this->contact_id,
|
||||||
@ -50,6 +52,7 @@ class Document extends JsonResource
|
|||||||
'created_by' => $this->created_by,
|
'created_by' => $this->created_by,
|
||||||
'created_at' => $this->created_at ? $this->created_at->toIso8601String() : '',
|
'created_at' => $this->created_at ? $this->created_at->toIso8601String() : '',
|
||||||
'updated_at' => $this->updated_at ? $this->updated_at->toIso8601String() : '',
|
'updated_at' => $this->updated_at ? $this->updated_at->toIso8601String() : '',
|
||||||
|
'category' => new Category($this->category),
|
||||||
'currency' => new Currency($this->currency),
|
'currency' => new Currency($this->currency),
|
||||||
'contact' => new Contact($this->contact),
|
'contact' => new Contact($this->contact),
|
||||||
'histories' => [static::$wrap => DocumentHistory::collection($this->histories)],
|
'histories' => [static::$wrap => DocumentHistory::collection($this->histories)],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user