Skip to content

Commit

Permalink
Add category object and category_id to document resource
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
vitormattos committed Jun 13, 2023
1 parent 1a2c711 commit 0e3f4e6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Http/Resources/Document/Document.php
Expand Up @@ -8,6 +8,7 @@
use App\Http\Resources\Document\DocumentItem;
use App\Http\Resources\Document\DocumentItemTax;
use App\Http\Resources\Document\DocumentTotal;
use App\Http\Resources\Setting\Category;
use App\Http\Resources\Setting\Currency;
use Illuminate\Http\Resources\Json\JsonResource;

Expand All @@ -32,6 +33,8 @@ public function toArray($request)
'due_at' => $this->due_at ? $this->due_at->toIso8601String() : '',
'amount' => $this->amount,
'amount_formatted' => money($this->amount, $this->currency_code, true)->format(),
'category_id' => $this->category_id,
'category' => new Category($this->category),
'currency_code' => $this->currency_code,
'currency_rate' => $this->currency_rate,
'contact_id' => $this->contact_id,
Expand Down

0 comments on commit 0e3f4e6

Please sign in to comment.