Changeset View
Changeset View
Standalone View
Standalone View
src/app/Observers/WalletObserver.php
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | public function updated(Wallet $wallet) | ||||
// Un-suspend and un-degrade the account owner | // Un-suspend and un-degrade the account owner | ||||
if ($wallet->owner) { | if ($wallet->owner) { | ||||
$wallet->owner->unsuspend(); | $wallet->owner->unsuspend(); | ||||
$wallet->owner->undegrade(); | $wallet->owner->undegrade(); | ||||
} | } | ||||
// Un-suspend domains/users | // Un-suspend domains/users | ||||
foreach ($wallet->entitlements as $entitlement) { | foreach ($wallet->entitlements as $entitlement) { | ||||
if ( | if (method_exists($entitlement->entitleable_type, 'unsuspend')) { | ||||
$entitlement->entitleable_type == \App\Domain::class | |||||
|| $entitlement->entitleable_type == \App\User::class | |||||
) { | |||||
$entitlement->entitleable->unsuspend(); | $entitlement->entitleable->unsuspend(); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } |