© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
Nuekrato

Relation Manager: How to customize edit action?

Given the following example of a
form
form
in a relation manager:
public function form(Form $form): Form
    {
        return $form
            ->schema([
                Checkbox::make('allowAllExtensions')
                    ->label(__('templates.allow_all_extensions'))
                    ->live()
                    ->dehydrated(false)
                    ->afterStateUpdated(function (Set $set) {
                        $set('allowed_file_extensions', ["*"]);
                    }),
                Repeater::make('allowed_file_extensions')
                    ->hidden(fn (Get $get) => $get('allowAllExtensions') === true)
                    ->label(__('templates.allowed_file_extensions'))
                    ->hint(__('templates.allowed_file_extensions_hint'))
                    ->simple(
                        TextInput::make('extension')
                            ->string()
                            ->regex('/^([a-zA-Z0-9]+)$/u')
                            ->required(),
                    ),
            ]);
    }
public function form(Form $form): Form
    {
        return $form
            ->schema([
                Checkbox::make('allowAllExtensions')
                    ->label(__('templates.allow_all_extensions'))
                    ->live()
                    ->dehydrated(false)
                    ->afterStateUpdated(function (Set $set) {
                        $set('allowed_file_extensions', ["*"]);
                    }),
                Repeater::make('allowed_file_extensions')
                    ->hidden(fn (Get $get) => $get('allowAllExtensions') === true)
                    ->label(__('templates.allowed_file_extensions'))
                    ->hint(__('templates.allowed_file_extensions_hint'))
                    ->simple(
                        TextInput::make('extension')
                            ->string()
                            ->regex('/^([a-zA-Z0-9]+)$/u')
                            ->required(),
                    ),
            ]);
    }


How can I hook into the updating process of the edit action of the form? A lot of the docs only mention resource pages and not the relation manager itself.

What I want to achieve:
- Set the pivot model's attribute to
['*']
['*']
if the checkbox is selected. I tried it using
afterStateUpdated
afterStateUpdated
but that doesn't work.

I think I need to hook into the form's lifecycle but it seems like a Relation Manager does not have anything like https://filamentphp.com/docs/3.x/panels/resources/editing-records#customizing-data-before-saving nor https://filamentphp.com/docs/3.x/panels/resources/editing-records#customizing-the-saving-process. Also this https://filamentphp.com/docs/3.x/actions/prebuilt-actions/edit#customizing-the-saving-process doesn't work, because the EditAction is only indirectly used in the
form
form
method of the Relation Manager?
Editing records - Panel Builder - Filament
Edit action - Actions - Filament
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Edit action not working on relation manager
FilamentFFilament / ❓┊help
3y ago
Customize Select in Relation Manager
FilamentFFilament / ❓┊help
12mo ago
Customize option labels in a relation manager attach action
FilamentFFilament / ❓┊help
12mo ago
How to refresh relation manager on action?
FilamentFFilament / ❓┊help
2y ago