© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
2 replies
Finn

Modify relationship data before inserting/creating

So I do have a resource, with a form with multiple text inputs.
In that form I made a fieldset that links to a relation

Forms\Components\Fieldset::make(self::$relationName)
                    ->relationship(self::$relationName)
                    ->label('Pagina informatie')
                    ->schema([
                        Forms\Components\TextInput::make('meta_title')
                             ->label('Meta title')
                             ->required(),
                        Forms\Components\TextInput::make('meta_description')
                             ->label('Meta description')
                             ->required(),
                    ])
Forms\Components\Fieldset::make(self::$relationName)
                    ->relationship(self::$relationName)
                    ->label('Pagina informatie')
                    ->schema([
                        Forms\Components\TextInput::make('meta_title')
                             ->label('Meta title')
                             ->required(),
                        Forms\Components\TextInput::make('meta_description')
                             ->label('Meta description')
                             ->required(),
                    ])


As you can see, in there I have 2 inputs in there. Now when I click on create in Filament, I want to modify the data from the text input.
Normally I would modify the data in the
app\Filament\Resources\MyResource\Pages\CreateMyResourcePage.php
app\Filament\Resources\MyResource\Pages\CreateMyResourcePage.php
using the
mutateFormDataBeforeCreate(array $data)
mutateFormDataBeforeCreate(array $data)
method.
But in the $data of the mutateFormDataBeforeCreate method, I do not have access to the relationship properties aPES_Think

So how would I modify it?
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

Save relationship first before creating model
FilamentFFilament / ❓┊help
2y ago
Modify data before saving on livewire
FilamentFFilament / ❓┊help
3y ago
Validate import before inserting records.
FilamentFFilament / ❓┊help
2y ago
Getting previous child relationship data before saving the parent data.
FilamentFFilament / ❓┊help
3y ago