© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
21 replies
Matthew

Action that changes value in Form

When the action Accept is pressed, the dropdown in the form should change to "Yes"

class EditExpense extends EditRecord
{
    protected static string $resource = ExpenseResource::class;

    protected function getActions(): array
    {
        return [
            Actions\DeleteAction::make(),
            Action::make('accept')
                ->color('success')
                ->label('Accept')
                ->disabled(!auth()->user()->can('status_expense'))
                ->requiresConfirmation()
                // ->action(function (Status $record, array $data): void {
                //     $record->author()->where('name', 'Yes')->first()->id;
                //     $record->save();
                // })
                // ->mountUsing(fn (Forms\ComponentContainer $form, User $record) => $form->fill([
                //     'status' => Status::where('name', 'Yes')->first()->id,
                // ]))
                ,
            // Action::make('reject')
            //     ->color('danger')
            //     ->label('Reject')
            //     ->action('rejectAction')
            //     ->disabled(!auth()->user()->can('status_expense')),
        ];
    }

}
class EditExpense extends EditRecord
{
    protected static string $resource = ExpenseResource::class;

    protected function getActions(): array
    {
        return [
            Actions\DeleteAction::make(),
            Action::make('accept')
                ->color('success')
                ->label('Accept')
                ->disabled(!auth()->user()->can('status_expense'))
                ->requiresConfirmation()
                // ->action(function (Status $record, array $data): void {
                //     $record->author()->where('name', 'Yes')->first()->id;
                //     $record->save();
                // })
                // ->mountUsing(fn (Forms\ComponentContainer $form, User $record) => $form->fill([
                //     'status' => Status::where('name', 'Yes')->first()->id,
                // ]))
                ,
            // Action::make('reject')
            //     ->color('danger')
            //     ->label('Reject')
            //     ->action('rejectAction')
            //     ->disabled(!auth()->user()->can('status_expense')),
        ];
    }

}
image.png
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

Form in Action
FilamentFFilament / ❓┊help
4mo ago
Action in Form
FilamentFFilament / ❓┊help
3y ago
Get Relationship Value in Table Action from Form
FilamentFFilament / ❓┊help
3y ago
Problem getting multiple select value in action modal form
FilamentFFilament / ❓┊help
2y ago