laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 28 forks source link

Add option to set missing implicitly bound model globally #2505

Closed mesiarm closed 3 years ago

mesiarm commented 3 years ago

Currently you can define missing method in case implicitly bound model is not found when defining route. (https://laravel.com/docs/8.x/routing#customizing-missing-model-behavior) It would be better to also have posibility to set it globally for all routes or for route group (web, api) without need to set it separately for each route.. (Maybe middleware or RouteServiceProvider?)

mesiarm commented 3 years ago

I have found a solution. Implicit binding throws ModelNotFoundException, which can be processed in ExceptionHandler.