-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Eloquent Update Method return model #13488
Comments
No, sorry. It also returns |
@GrahamCampbell Actually it is returning Get on localhost:8000/client/1 {
"id": 1,
"name": "Ashly Lehner",
"responsible": "Kristy Kuhn",
"email": "tveum@example.com",
"phone": "1-717-936-3681",
"address": "2893 Deonte Inlet\nDevonberg, IL 38054",
"obs": "Enim et eos voluptatem voluptas.",
"created_at": "2016-05-09 12:48:13",
"updated_at": "2016-05-09 12:48:13"
} Content of the update() method: Client::find($id)->update($request->all()); For an empty PUT request (nothing is gonna change) the result is For a PUT request with (name = current name):
the result is also For a PUT request with (name != current name):
the result is also I would expect to get a false on the empty PUT request and maybe a false when the request content is the same as the model content, both cases return true, it does return false if the model doesn't pass on a custom validation. Maybe this behavior is not implemented yet? |
Currently the update() method is returning the result of the save() (Boolean), on the other hand the create method is returning a model, shouldn't the update method also return a model?
This way the update method keeps the fluent interface, also for a rest app for the put method you could just:
And the result would be a json of the updated model...
Is this worth changing?
The text was updated successfully, but these errors were encountered: