2 years ago

[Laravel 5.4] How to get the current HTTP status code in 404 error page?

Posted 2 years ago by berkantipek

I have created my own 404 error template in "views/errors/404.blade.php". However I'd like to get the current status code (404) in the template or its parent layouts extended in it.

Ironically, both http_response_code() and app('Illuminate\Http\Response')->status() returns me 200 as I'm expecting to get 404.

What's the problem?

Please sign in or create an account to participate in this conversation.