diff --git a/app/Http/Resources/TagResource.php b/app/Http/Resources/TagResource.php new file mode 100644 index 00000000..2f22aeb8 --- /dev/null +++ b/app/Http/Resources/TagResource.php @@ -0,0 +1,18 @@ + $this->id, + 'name' => $this->name, + 'color' => $this->color, + ]; + } +} diff --git a/app/Http/Resources/TransactionResource.php b/app/Http/Resources/TransactionResource.php index 680ecd92..ad8bbb95 100644 --- a/app/Http/Resources/TransactionResource.php +++ b/app/Http/Resources/TransactionResource.php @@ -14,6 +14,7 @@ public function toArray(Request $request): array return [ 'id' => $this->id, + 'tag' => !$isEarning && $this->tag_id ? new TagResource($this->tag) : null, 'type' => $isEarning ? 'earning' : 'spending', 'happened_on' => $this->happened_on, 'description' => $this->description, diff --git a/resources/assets/js/prototype/screens/Transactions/Index.vue b/resources/assets/js/prototype/screens/Transactions/Index.vue index 56e99fae..1afada28 100644 --- a/resources/assets/js/prototype/screens/Transactions/Index.vue +++ b/resources/assets/js/prototype/screens/Transactions/Index.vue @@ -1,4 +1,5 @@