© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•9mo ago•
4 replies
Asmit

saveRelationshipsUsing on custom page form.

I have a custom page with attachment relationship like
 public function form(Form $form): Form
    {
      return $form->([
        TextInput::make('name'),
        Repeater::make('cover_images')
            ->label('Covers')
            ->relationship('coverPhotos')
            ->schema([
                TextInput::make('image')
                    ->label('File Path')
                    ->required(),
                TextInput::make('note')
                    ->label('Note'),
            ])
            ->saveRelationshipsUsing(function ($state) {
                dd('saveRelationshipsUsing', $state);
            })
    ])
}

 public function saveAction(): Action
 {
    return Action::make('save')->action(fn() => //...);
  }
 public function form(Form $form): Form
    {
      return $form->([
        TextInput::make('name'),
        Repeater::make('cover_images')
            ->label('Covers')
            ->relationship('coverPhotos')
            ->schema([
                TextInput::make('image')
                    ->label('File Path')
                    ->required(),
                TextInput::make('note')
                    ->label('Note'),
            ])
            ->saveRelationshipsUsing(function ($state) {
                dd('saveRelationshipsUsing', $state);
            })
    ])
}

 public function saveAction(): Action
 {
    return Action::make('save')->action(fn() => //...);
  }

Blade file
 <div class="mt-6 gap-2 flex">
     {{ $this->form }}
      {{ $this->saveAction }}
  </div>
 <div class="mt-6 gap-2 flex">
     {{ $this->form }}
      {{ $this->saveAction }}
  </div>

I don't know why the
saveRelationshipsUsing
saveRelationshipsUsing
is not trigger, is there any thing I missed out ?
Thank you
Solution
are you using this in your saveAction?

$model = YourModel::create($this->form->getState());
$this->form->model($model)->saveRelationships();
$model = YourModel::create($this->form->getState());
$this->form->model($model)->saveRelationships();


https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component#passing-the-form-model-after-the-form-has-been-submitted
Adding a form to a Livewire component - Forms - Filament
Jump to solution
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

Custom page custom form
FilamentFFilament / ❓┊help
2y ago
custom page form from resource
FilamentFFilament / ❓┊help
11mo ago
How to custom page form
FilamentFFilament / ❓┊help
3y ago
Custom Page with Form Builder
FilamentFFilament / ❓┊help
3y ago