0

I wanted to use Sentinel::getUser() in the AppServiceProvider.php to make it global in all front-end files.

I include it in the boot function, like this:

view()->share( 'loggedUser', Sentinel::getUser() ); 

or

View::share("loggedUser",Sentinel::getUser());

Also have I included:

use Cartalyst\Sentinel\Native\Facades\Sentinel;

But when I do it the only response is NULL. When I use Sentinel:getuser() in a blade file it works.

Not only is it giving NULL as response, when I have that included my php artisan also return NULL on every command I make.

Does anyone know what to do?

Troyer
  • 6,765
  • 3
  • 34
  • 62
  • Which version of Laravel are you using? :) – Troyer Aug 02 '17 at 14:17
  • Laravel version 5.4.28 – Orriginal Aug 02 '17 at 14:19
  • What about [view creators/composers](https://laravel.com/docs/5.4/views)? Creators run before variables are set, composers run after, so they override values passed in when creating the view. – Dissident Rage Aug 02 '17 at 14:37
  • The thing with view creators/composers is that its good to bind to a partial what u use more times in the application. But I need to reach it from all views. Thats why I want it globaly. – Orriginal Aug 02 '17 at 15:09

0 Answers0