previousUrl; } protected function mutateFormDataBeforeSave(array $data): array { $data['enabled'] = (bool)$data['enabled']; return $data; } /** * @throws Halt */ protected function handleRecordUpdate(Model|Account $record, array $data): Model|Account { $user = Auth::user(); if (!$user) { throw new Halt('No authenticated user found.'); } $oldCurrency = $record->currency_code; $newCurrency = $data['currency_code']; if ($oldCurrency !== $newCurrency) { $data['opening_balance'] = Currency::convertBalance( $data['opening_balance'], $oldCurrency, $newCurrency ); } $this->handleRecordUpdateWithUniqueField($record, $data, $user); return parent::handleRecordUpdate($record, $data); } }