FilamentF
Filament2y ago
Xavi

Refresh field after modal form

I want to refresh field after modal form, but i don't know how? Anyone can helpme?

Its my code:

TextInput::make('deposit')
->label(__('Saldo'))
->formatStateUsing(fn(User $user) => $user->getWallet()->balance)
->disabled()
->suffixAction(
    Action::make('updateDeposit')
        ->label(__('Actualizar saldo'))
        ->icon('heroicon-m-clipboard')
        ->form([
            TextInput::make('amount')
                ->label(__('Cantidad'))
                ->required()
                ->numeric(),
            TextInput::make('description')
                ->required()
                ->label(__('Descripción'))
        ])
        ->action(function ($action, array $data, User $record): void {
            $walletService = new WalletService($record);

            if ($data['amount'] > 0) {
                $walletService->deposit($data['amount'], $data['amount']);
            }

            if ($data['amount'] < 0) {
                $walletService->withdraw($data['amount'], -$data['amount']);
            }

            Notification::make()
                ->title(__('Saldo actualizado'))
                ->body(__('El saldo se ha actualizado correctamente'))
                ->send();
        })

),


Thanks
Was this page helpful?