tracker
tracker copied to clipboard
Argument 1 passed to Illuminate\Database\Eloquent\Model::guard() must be of the type array, null given, called in /home/vagrant/Code/vendor/pragmarx/tracker/src/Services/Authentication.php on line 40
Recently I come across below error message locally and in production if the tracker is enabled and no page from the application is reachable:
Argument 1 passed to Illuminate\Database\Eloquent\Model::guard() must be of the type array, null given, called in /home/vagrant/Code/vendor/pragmarx/tracker/src/Services/Authentication.php on line 40
I came across this issue on laravel 5.6. I have updated my laravel to 5.8 and using the latest tracker package (3.4) still the issue is not resolved.
While I was debugging the app I encountred below exception before the second expedition (which is only happening on debug mode):
Exception has occurred.
Illuminate\Contracts\Container\BindingResolutionException: Target [Snowplow\RefererParser\Config\ConfigReaderInterface] is not instantiable while building [PragmaRX\Tracker\Support\RefererParser, Snowplow\RefererParser\Parser].
I'm not sure how to reproduce this. I used to work just fine. My local system is windows 10, I have setup vagrant and homestead to set the app locally. in production I have Ubuntu.
Looks like the guard doesn't work as expected, here is my finds during debugging:
Adding more info:
my tracker config info:
'use_middleware' => true,
'authenticated_check_method' => 'check',
authentication_ioc_binding' => ['auth', 'App\Admin'],
Admin Model:
class Admin extends Authenticatable
{
use Notifiable;
protected $connection = 'mysql';
protected $guard = "admins";
public function getIsAdminAttribute()
{
return true;
}
public static function check()
{
return Auth::guard('admins')->check();
}
public static function user()
{
return Auth::guard('admins')->user();
}
}
@gabriel-cardoso Gabriel Cardoso, I was wondering if you could have a look at the exception I have been encountering? It might be side effect of changes made for "Added authentication_guards config. Refs #331"