The $default value is never returned
public static function getDefaultName($class): string
{
$default = config('auth.defaults.guard');
return static::getNames($class)->first() ?: $default;
}
same here, I am using version 2.37.0
I can't assign roles to a selected user with the same guards.
return static::getNames($class)->first() ?: $default;
This is by design in v2.
Changing it in v2 will break existing installations.
There are plans to remove the guard complexity in a future version.
Workaround: put the guard you want as the first item in the 'guards' array.
'guards' => [
/**
* Workaround: put the guard you want as the first item in the 'guards' array
* @see Spatie\Permission\Guard#getDefaultName
*/
'backpack' => [
"driver" => "session",
"provider" => "backpack"
],
'web' => [ .....
thanks man.
Most helpful comment
Workaround: put the guard you want as the first item in the 'guards' array.