© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
Mdk

Custom Action that calls "save" doesn't actually save the model

So I'm trying to put a save button elsewhere in an Edit page
Grid::make('card_payment')
    ->visible(fn($get) => $get('payment_method') === 'card')
    ->schema([
        TextInput::make('balance_used')
            ->label(__uf('use balance'))
            ->hint(__uf('balance available').': '.money(auth()->user()->balance, env('CASHIER_CURRENCY')))
            ->numeric()
            ->minValue(0)
            ->maxValue(auth()->user()->balance)
            ->live(debounce:500)
            //->afterStateUpdated(fn($state) => dump($state))
            ->prefix('€'),
        Actions::make([
            Actions\Action::make('paybycard')
                ->label(fn($record, $get) =>
                    __uf('proceed to payment').' - '.money($record->order_total + $record->shipping_cost - ($get('balance_to_use')?:0), env('CASHIER_CURRENCY')))
                ->submit('save')
        ])->fullWidth()
    ])
Grid::make('card_payment')
    ->visible(fn($get) => $get('payment_method') === 'card')
    ->schema([
        TextInput::make('balance_used')
            ->label(__uf('use balance'))
            ->hint(__uf('balance available').': '.money(auth()->user()->balance, env('CASHIER_CURRENCY')))
            ->numeric()
            ->minValue(0)
            ->maxValue(auth()->user()->balance)
            ->live(debounce:500)
            //->afterStateUpdated(fn($state) => dump($state))
            ->prefix('€'),
        Actions::make([
            Actions\Action::make('paybycard')
                ->label(fn($record, $get) =>
                    __uf('proceed to payment').' - '.money($record->order_total + $record->shipping_cost - ($get('balance_to_use')?:0), env('CASHIER_CURRENCY')))
                ->submit('save')
        ])->fullWidth()
    ])


Both
payment_method
payment_method
and
balance_used
balance_used
are properties of the model that is being edited
I tried with both
submit('save')
submit('save')
as well as
action('save')
action('save')
, they both trigger the validation and display the success notification, but the model is not updated and neither
protected function beforeSave()
protected function beforeSave()
or
protected function afterSave()
protected function afterSave()
are called.. what am I doing wrong?
My plan was to save the order and then redirect to the payment page in the
afterSave
afterSave
method, I would've used a custom action but I couldn't manage to trigger the validation with that
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Textarea doesn't save
FilamentFFilament / ❓┊help
3y ago
modal doesn't save
FilamentFFilament / ❓┊help
3y ago
Can't save form action
FilamentFFilament / ❓┊help
2y ago
"Create & Create another" doesn't work on custom action
FilamentFFilament / ❓┊help
15mo ago