Changeset View
Changeset View
Standalone View
Standalone View
src/app/Observers/WalletObserver.php
Show First 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | public function updated(Wallet $wallet) | ||||
) { | ) { | ||||
$entitlement->entitleable->unsuspend(); | $entitlement->entitleable->unsuspend(); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// Remove RESTRICTED flag from the wallet owner and all users in the wallet | // Remove RESTRICTED flag from the wallet owner and all users in the wallet | ||||
if ($wallet->balance > $wallet->getOriginal('balance') && $wallet->owner && $wallet->owner->isRestricted()) { | if ($wallet->balance > $wallet->getOriginal('balance') && $wallet->owner && $wallet->owner->isRestricted()) { | ||||
$wallet->owner->unrestrict(); | $wallet->owner->unrestrict(true); | ||||
User::whereIn( | |||||
'id', | |||||
$wallet->entitlements()->select('entitleable_id')->where('entitleable_type', User::class) | |||||
)->each(function ($user) { | |||||
$user->unrestrict(); | |||||
}); | |||||
} | } | ||||
} | } | ||||
} | } |