Summer Sale! All accounts are 50% off this week.

laracoft's avatar

$message in abort(404) does not show

Hi,

  • PHP version: 7.4.30
  • Laravel version: 8.83.23

Any idea why I get "404 | NOT FOUND" even though I called abort(404, "Sorry")?

0 likes
5 replies
laracoft's avatar

@sinnbeck I see, quite a pain given that 403 allows a custom message, but thanks!

Sinnbeck's avatar

@laracoft You can chance the template to do the same as 403

403

@section('message', __($exception->getMessage() ?: 'Forbidden'))

404

@section('message', __('Not Found'))
Sinnbeck's avatar

@laracoft Most likely because you dont want your 404 page to show some "model not found" error.

Please or to participate in this conversation.