© 2026 Hedgehog Software, LLC

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

save model relationships on a standalone form builder with repeater

I have the following standalone form. How do I go about saving the relations on the model?

 public function mount()
    {
        $this->customer = User::find(1);

        $this->form->fill([
            'notifications' => $this->customer->userNotifications
        ]);
    }

    public function getFormSchema(): array
    {
        return [
            Repeater::make('notifications')
                ->schema([
                    TextInput::make('notification')
                        ->hiddenLabel()
                        ->columnSpan(2)
                        ->disabled(),
                    Toggle::make('email')->label('E-mail'),
                    Toggle::make('sms')->label('Text')
                ])->addable(false)->columns(4)->reorderable(false)->deletable(false)->hiddenLabel()
        ];
    }

    public function getFormModel(): Model|string|null
    {
        return $this->customer;
    }

    public function save()
    {
        $this->form->model($this->customer)->saveRelationships();
    }
 public function mount()
    {
        $this->customer = User::find(1);

        $this->form->fill([
            'notifications' => $this->customer->userNotifications
        ]);
    }

    public function getFormSchema(): array
    {
        return [
            Repeater::make('notifications')
                ->schema([
                    TextInput::make('notification')
                        ->hiddenLabel()
                        ->columnSpan(2)
                        ->disabled(),
                    Toggle::make('email')->label('E-mail'),
                    Toggle::make('sms')->label('Text')
                ])->addable(false)->columns(4)->reorderable(false)->deletable(false)->hiddenLabel()
        ];
    }

    public function getFormModel(): Model|string|null
    {
        return $this->customer;
    }

    public function save()
    {
        $this->form->model($this->customer)->saveRelationships();
    }


calling
saveRelationships()
saveRelationships()
seems to do nothing. I checked the queries executed and there aren't any update statement. Any ideas what the issue may be? I looked into the docs and couldn't figure out.
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

Changing colours on standalone Form Builder without Panels
FilamentFFilament / ❓┊help
2y ago
Translatable Builder/Repeater Form Field
FilamentFFilament / ❓┊help
2y ago
Eloquent Builder with relationships
FilamentFFilament / ❓┊help
3y ago