Support the ongoing development of Laravel.io →
Laravel
Last updated 3 weeks ago.
0

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!

Cloudways

Your banner here too?

Moderators

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

Your logo here?

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

© 2022 Laravel.io - All rights reserved.