lundi 24 octobre 2016

How do I make a logged in user object available to all views in Laravel 5.3

I want to be able to get a logged in user's details in my views. E.g .

Here's my Controller.php:

public $view_data = array();

public function __construct()
{
    $this->middleware('auth');
    $this->view_data['user'] = Auth::user();
}

$user in my views return NULL. Am I missing something?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire