I’m trying to use UUID for spatie, and followed the instruction from official document. Everything went well until I have to assignRole to user.
It return 0
Where it should have same value as role_id
these are my codes following the guide
config/permission.php
'models' => [
'permission' => AppModelsPermission::class,
'role' => AppModelsRole::class,
],
'column_names' => [
'role_pivot_key' => null, //default 'role_id',
'permission_pivot_key' => null, //default 'permission_id',
'model_morph_key' => 'model_ulid',
'team_foreign_key' => 'team_id',
],
user seeder
$user = User::create([
.
.
.
]);
// Set TeamId
setPermissionsTeamId(1);
$user->assignRole('superadmin');
both of my role and permission models
class Role extends SpatieRole
{
use HasFactory, HasUlids;
protected $primaryKey = 'ulid';
protected $fillable = [
'name',
'guard_name',
];
}