Support the ongoing development of Laravel.io →
posted 3 years ago
Laravel
Last updated 1 year ago.
0
moderator

There is a difference between report and render. Report is intended do decide if an errror need to be reported to the system (your logging) and render is intended for your output.

The ModelNotFound exception is registered as an internal don't report so it will never be reported, see: https://github.com/laravel/framework/blob/8.x/src/Illuminate/F...

The ModelNotFoundException is indirect already rendered, it is transformed to a NotFoundHttpException, see: https://github.com/laravel/framework/blob/8.x/src/Illuminate/F... You can customize the output with blades, see: https://laravel.com/docs/8.x/errors#custom-http-error-pages

Another option that looks like your code is to use the the renderable function instead of the reportable, see: https://laravel.com/docs/8.x/errors#rendering-exceptions

I hope this makes it clear for you to see how the exceptions are handled.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.