Skip to content

Commit 44e86c7

Browse files
committed
Fix toJson and toVue method
1 parent 5b0dcbe commit 44e86c7

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/Traits/Formatter.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@
22

33
namespace Akaunting\Apexcharts\Traits;
44

5+
use Illuminate\Http\JsonResponse;
6+
7+
/** @mixin \Akaunting\Apexcharts\Chart */
58
trait Formatter
69
{
7-
public function toJson()
10+
public function toJson(): JsonResponse
811
{
9-
return response()->json([
10-
'id' => $this->id(),
11-
'options' => $this->getOptions(),
12-
]);
12+
return response()->json($this->toVue());
1313
}
1414

1515
public function toVue(): array
1616
{
1717
return [
18+
'id' => $this->getId(),
1819
'height' => $this->getHeight(),
1920
'width' => $this->getWidth(),
2021
'type' => $this->getType(),
21-
'options' => $this->getOptions(),
22-
'series' => json_decode($this->getSeries()),
22+
'options' => json_decode($this->getOptions(), true),
23+
'series' => $this->getSeries(),
2324
];
2425
}
2526
}

0 commit comments

Comments
 (0)