Changeset View
Changeset View
Standalone View
Standalone View
src/app/Observers/UserObserver.php
Show First 20 Lines • Show All 265 Lines • ▼ Show 20 Lines | private static function removeRelatedObjects(User $user, $force = false): void | ||||
}); | }); | ||||
if ($force) { | if ($force) { | ||||
// Remove "wallet" transactions, they have no foreign key constraint | // Remove "wallet" transactions, they have no foreign key constraint | ||||
\App\Transaction::where('object_type', Wallet::class) | \App\Transaction::where('object_type', Wallet::class) | ||||
->whereIn('object_id', $wallets) | ->whereIn('object_id', $wallets) | ||||
->delete(); | ->delete(); | ||||
} | } | ||||
// regardless of force delete, we're always purging whitelists... just in case | |||||
machniak: Not that big of a deal, but this is execute on deleting and on forceDeleting. It would make… | |||||
\App\Policy\RateLimitWhitelist::where( | |||||
[ | |||||
'whitelistable_id' => $user->id, | |||||
'whitelistable_type' => User::class | |||||
] | |||||
)->delete(); | |||||
} | } | ||||
} | } |
Not that big of a deal, but this is execute on deleting and on forceDeleting. It would make sense to do this once.