为什么用户和会话在Laravel中从AppServiceProvider中获取时不起作用?

I'm using AppServiceProvider to pass data to all views, like I was told:

<?php namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use App\User;
use Session;

class AppServiceProvider extends ServiceProvider {

    public function boot()
    {
        $userID = Session::get('userID');
        $user = User::find($userID);
        view()->share('user', $user);
    }

    public function register()
    {
        $this->app->bind(
            'Illuminate\Contracts\Auth\Registrar',
            'App\Services\Registrar'
        );
    }
}

This causes no errors, however $user is null in my views. This same code to obtain $user works just fine when returned directly from a regular Controller. The views also work fine when $user is injected manually.

The next step was to create a new method in the User model:

public static function getSessionUser(){
    return self::find(Session::get('SteamID64'));
}

Again, this works just fine everywhere except at AppServiceProvider.

I'm open to any suggestion, even a different approach to pass $user to my views.

I don't understand what causes this and really need help with it. Thanks for your time!

I'm not very experienced with Laravel but I suspect this service provider is just not being loaded. Have you added the provider to the 'providers' array in your config/app.php file?