Skip to content

Commit

Permalink
feat: array data
Browse files Browse the repository at this point in the history
  • Loading branch information
jiannei committed Oct 10, 2023
1 parent 1dfdf3e commit 5e19441
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Support/Traits/JsonResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ function ($response) use ($data) {
return $this->formatter->response($this->formatter->paginator(...func_get_args()), $code, $headers, $option);
}

if ($data instanceof Arrayable) {
if ($data instanceof Arrayable || (is_object($data) && method_exists($data, 'toJson'))) {
$data = $data->toArray();
}

Expand Down

0 comments on commit 5e19441

Please sign in to comment.