Replies: 1 comment 1 reply
-
Notes / other Ideas:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The idea is a new method on the Model that returns a new instance of a
ModelNotFoundException
and the return has to be an instance ofModelNotFoundException
to prevent breaking changes.This method is called everywhere where the core throws a
ModelNotFoundException
- likefirstOrFail()
,findOrFail()
...With that method, the user can create a new custom exception
UserNotFoundException
which is always thrown when aUser
model is not found.Right now I'm doing this with the
\Illuminate\Foundation\Exceptions\Handler::map()
functionality. But having a method on the model would be more intuitive - like customizing the collection or query builder.https://twitter.com/devgummibeer/status/1521093637123321858
Beta Was this translation helpful? Give feedback.
All reactions