Why does not my "web page not found 404" in laravel 5.3 work for me?

0

I create a view and add it to the file app/Exception/Handler.php of the following way:


public function render($request, Exception $e){
    if ($this->isHttpException($e)){
        return $this->renderHttpException($e);
    }else if($e instanceof NotFoundHttpException){
        return response()->view('errors.404', [], 404);
    }else{
        return parent::render($request, $e);
    }
}

the View:

@extends('layouts.plantilla_general') 
 
@section('content')
        <div id="page-wrapper">
            <div class="row"> 
                <div class="col-lg-12">
                    <h1 class="page-header">Error</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
                <div class="col-lg-12 col-center">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Error
                        </div>
                        <div class="panel-body">
                            <h1>Error 404</h1>
                            <h3>La dirección que usted indicó no se encuentra.</h3>
                            <h3>Por favor, verifique e intente de nuevo.</h3>
                        </div>
                        <div class="panel-footer">

                        </div>
                    </div>
                    <!-- /.panel -->

                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
        </div>
        <!-- /#page-wrapper -->
@stop

That template that I use works correctly in all the other views and I call it the way.

In that view it does not work for me or I do not know why the following error:

3/3 ErrorException in f01ad76b252031da132b58646a0076e33be5b20b.php line 239: Trying to get property of non-object (View: D: \ My Documents \ Paul \ SIMante \ System \ SIMante \ resources \ views \ layouts \ template_general.blade.php) (View: D: \ My Documents \ Pablo \ SIMante \ System \ SIMante \ resources \ views \ layouts \ template_general.blade.php)
2/3 ErrorException in f01ad76b252031da132b58646a0076e33be5b20b.php line 239: Trying to get property of non-object (View: D: \ My Documents \ Paul \ SIMante \ System \ SIMante \ resources \ views \ layouts \ template_general.blade.php)
1/3 ErrorException in f01ad76b252031da132b58646a0076e33be5b20b.php line 239: Trying to get property of non-object
    
asked by Pablo Contreras 17.12.2016 в 19:43
source

2 answers

1

Pablo, the error says that the problem is in the general template (line 239), because being in an incorrect page you are not loading any object (hence the error Trying to get property of non-object - Trying to access to a property of a non-object).

Check that line and you'll see what object you're looking at, most likely from the authenticated user or something like that.

Greetings.

PS: when laravel throws you these errors it is easier to go to the compiled view and see what line it refers to, in this case the file is called f01ad76b252031da132b58646a0076e33be5b20b.php and it is in the directory < strong> storage / framework / views .

    
answered by 18.12.2016 в 04:33
0

As José Eduardo Rios comments, you should check template_general.blade.php since you are surely trying to get an attribute that does not exist in an object.

    
answered by 21.12.2016 в 02:24