If you use the message I suspect that you see it in the browser as a view. I think the best solution then is to use a custom error page.
See the documentation: https://laravel.com/docs/9.x/errors#custom-http-error-pages
I think you can use this code in your blade if you need to model name:
// the 404 page is from a NotFoundHttpException
// that has the ModelNotFoundException as previous
<h2>Model: {{ $exception->getPrevious()->getModel() }}</h2>
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community