1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 19:14:04 +00:00

Update specific attributes of pending tenants while they're being pulled (#59)

* Add option to update attributes of pending tenants while pulling them

* Fix failing toEqualCanonicalizing tests

* Fix code style (php-cs-fixer)

* fix code errors

* lock phpcsfixer to 3.62.0 due to a bug in 3.63.1

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
This commit is contained in:
lukinovec 2024-08-28 00:41:16 +02:00 committed by GitHub
parent 87e02f207f
commit 6b74589d76
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 11 additions and 12 deletions

View file

@ -73,14 +73,14 @@ trait HasPending
}
/** Try to pull a tenant from the pool of pending tenants. */
public static function pullPendingFromPool(bool $firstOrCreate = false): ?Tenant
public static function pullPendingFromPool(bool $firstOrCreate = false, array $attributes = []): ?Tenant
{
if (! static::onlyPending()->exists()) {
if (! $firstOrCreate) {
return null;
}
static::createPending();
static::createPending($attributes);
}
// A pending tenant is surely available at this point
@ -89,9 +89,9 @@ trait HasPending
event(new PullingPendingTenant($tenant));
$tenant->update([
$tenant->update(array_merge($attributes, [
'pending_since' => null,
]);
]));
event(new PendingTenantPulled($tenant));