The relationship caused problems
We should not write this many to many relationship inside User's model if we use Spatie permissions package
public function roles()
{
return $this->belongsToMany(Role::class, 'model_has_roles', 'model_id', 'role_id');
}