Open wasifkarigar opened 4 years ago
Got the same thing happen when upgrading laravel.
Vendor/Laravel/ServiceProvider.php
public function boot()
{
parent::boot();
if (!$this->getConfig('enabled')) {
return false;
}
$this->loadRoutes();
$this->registerErrorHandler();
// $this->bootTracker();
$this->loadTranslations();
}
You can just comment this line out ($this->bootTracker();
) in the package Service Provider boot method.
https://github.com/antonioribeiro/tracker/blob/master/src/Vendor/Laravel/ServiceProvider.php#L84
The tracker should be booted already with the Middleware and the auth method / user id should work there. Digging a bit deeper I can see some code to avoid rebooting or rebinding a new tracker when the Service Provider comes next in the request lifecycle, but I'm too tired now to understand why the hell this doesn't work anymore. I'm not aware of any changes there with Laravel, the documentation is still the same.
Also be aware that if you have some places where you track events that don't go through the http tracker middleware, this fix might cause some problems.
Getting userid null after successful login
It was working fine before after upgrading laravel its logging users but storing userid to null.
System
Config:
` return [
// 'login/*', ],
// 'user_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\User', // 'user_model' => \Satfish\User::class, 'user_model' => '\Satfish\User',
// 'referer_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Referer', 'referer_model' => 'Satfish\Referer',
]; `
I have tried to debug that on my own and dump in src/Tracker.php file => getUserId() and in src/ReposirtoryManager => getCurrentUserId() , its giving false on login. I think this should give logged in user id.