-
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
[8.x] Add updateOrFail
method to Model
#38592
Conversation
sql drivers always throw an exception? what driver are you using? |
@crissi I'm using the MySQL driver, but what is the difference between |
I see... did not know saveOrFail or existed. |
This makes it more convenient to handle update errors in update actions.
The PHPDoc confirms my assumption that framework/src/Illuminate/Database/Eloquent/Model.php Lines 864 to 871 in 6de0174
framework/src/Illuminate/Database/Eloquent/Model.php Lines 986 to 994 in 6de0174
|
Note: |
* Add `updateOrFail` method to `Model` This makes it more convenient to handle update errors in update actions. * Update Model.php Co-authored-by: Taylor Otwell <taylor@laravel.com>
The
updateOrFail()
method makes it more convenient to handle update errors in update actions, as it is less verbose than checking the return value ofupdate()
.