Trying to get property of non-object laravel 5.2

-2

  

ErrorException in SitioController.php line 16: Trying to get property   of non-object

I have a problem with the code. Any help please?

These are the errors that you get when trying with the code that you have given me

    
asked by Ignacio S. J. 31.10.2018 в 18:35
source

1 answer

0

faster your code would be like that;

$data = Configuracion::all();
return view('sitio.index',compact('data'));

and only in the view will you pass the {{ $data->nombre }}

in the error you are trying to get a property that is not an object. when you do the queries usually there is already an array in which the index of that array comes from 0, 1, 2, 3 .... etc .. test and warnings.

    
answered by 31.10.2018 в 18:42