BFI has roles

This commit is contained in:
a6a2f5842 2025-10-31 11:00:52 +01:00
parent a854e85388
commit 241f5ae53b
1 changed files with 3 additions and 1 deletions

View File

@ -24,7 +24,7 @@ trait HasRoles
)->withPivot('expires_at', 'created_at', 'updated_at')
->withTimestamps()
->where(function ($q) use ($pivotTable) {
$q->wherePivot('expires_at', '>', now())
$q->where($pivotTable . '.expires_at', '>', now())
->orWhereNull($pivotTable . '.expires_at');
});
}
@ -122,6 +122,7 @@ trait HasRoles
if (is_string($role) && !is_numeric($role)) {
$roleModel = config('roles.models.role', \Blax\Roles\Models\Role::class)::firstOrCreate([
'name' => $role,
], [
'slug' => str()->slug($role)
]);
} elseif (is_numeric($role)) {
@ -166,6 +167,7 @@ trait HasRoles
if (is_string($role) && !is_numeric($role)) {
$role = config('roles.models.role', \Blax\Roles\Models\Role::class)::firstOrCreate([
'name' => $role,
], [
'slug' => str()->slug($role)
]);
} elseif (is_numeric($role)) {