I want to get the sentinel logged user to front-end. In my front-end blade PHP I used Sentinel::check()
method. But it return false
. When I check the same condition in the controller class it return true
. So I want to find out how to get the logged user to front-end.
Asked
Active
Viewed 1,614 times
-1

Fanjo Lama
- 581
- 3
- 15

Chathurika Mahanama
- 11
- 1
- 1
- 6
-
2I'm not familiar with Sentinel, but you can make a variable available to all of your views. In your **AppServiceProvider@boot** add `view()->share( 'isUserLogged', Sentinel::check() );` and it will be available on all your views like this `$isUserLogged`. – thefallen May 27 '16 at 07:15
1 Answers
1
You can get the logged user to all the front-end pages by adding following line of code to boot method in AppServiceProvider.php class.
view()->share( 'loggedUser', Sentinel::getUser() );
After that you can access the Sentinel user from the loggedUser variable in all the front-end classes. Form it you can access all the Sentinel::getUser()
related methods from the front-end.

Manula Thantriwatte
- 316
- 1
- 4
- 18