I've been having a little trouble with Auth data in Laravel 5.1 I want to get the id of the Logged user and It works if I use it in a View, lets say:
<?php echo Auth::user()->id;?>
But if I try to access to it in a Controller it dowsnt work, and I get this error:
ErrorException in Con_Mascota.php line 101:
Trying to get property of non-object
In line 101 i've:
$cod_usu=$request->user()->cod_usu;
I changed that from $cod_usu=Auth::user()->cod_usu; cause that didnt work either.
Im also including it in the Controller:
use Auth;
Any help is much appreciated :)
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire