Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why can't $this->success(123) #137

Closed
aogg opened this issue Apr 1, 2019 · 1 comment
Closed

why can't $this->success(123) #137

aogg opened this issue Apr 1, 2019 · 1 comment

Comments

@aogg
Copy link

aogg commented Apr 1, 2019

use \App\Helper\Vendor\MakesResponses

Argument $resource should be an instance of League\Fractal\Resource\Item or League\Fractal\Resource\Collection

image

support $this->success(123)

@flugg
Copy link
Owner

flugg commented Jun 6, 2019

Hi, sorry for the delayed response. Unfortunately, this is a limitation with the Fractal library. It only supports Primitive values as nested values. The root value must be serializable as an array. You would have to do something like:

$this->success(['number' => 123]);

@flugg flugg closed this as completed Jun 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants