Search code examples
laravel-5laravel-5.1laravel-5.3

View [errors.404] not found


I am opening a page which is not present in my application and in order to get rid of 404 error, I wrote below code.

public function report(Exception $exception)
{
    if($this->isHttpException($exception)) {
        switch ($exception->getStatusCode()) {
            case '404':
                return \Response::view('errors.404');
        }
    }
    parent::report($exception);
}

Directory structure is like below and you could see there is 404 Blade inside errors directory

My Directory Structure here. Please click it to view the details

When I run the above code, it shows below error.

View [errors.404] not found

Am I missing something?

Thank you very much in advance for any suggestion.


Solution

  • Fix typo in the filename. Blade is misspelled.

    You named your file: 404.bade.php instead of 404.blade.php

    enter image description here