-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add __toString
on ApiResponse
#11
Comments
+1 on implementing I'm curious about your desired implementation of the |
@DivineOmega Nothing crazy, would just allow people to push into
|
Looks good. Shouldn't be breaking in any way. |
@DivineOmega Just noticed an issue, |
@dextermb In that case, the best thing you could do is to make |
@DivineOmega Would Laravel's response pick it up as JSON and know to respond with JSON headers? |
@dextermb No, it would return a plain text response unless to requester specifically asked for JSON. Idea: Why not extend |
Would like to see someone have a go at this. |
I think that we should add
__toString()
toApiResponse
as when returning from a controller it attempts to convert the returned object to a string, if we were to implement this it would save us from adding->json()
on the end of every API return.Proposed code
Thoughts? We could also implement
ArrayAccess
for even more accessibility.cc @DivineOmega @JacobBrassington @wheatleyjj
The text was updated successfully, but these errors were encountered: