© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
9 replies
Augus

Relationship not saved to Model on Section

In my UserResource i got a Section as followed:

  Section::make('Contactgegevens')
    ->relationship('contact')
    ->schema([...
  Section::make('Contactgegevens')
    ->relationship('contact')
    ->schema([...


This does create a new contact when i fill in the needed fields, but it does not attach that contact to my User.

User Model:
    public function contact(): HasOne
    {
        return $this->hasOne(Contact::class, 'id', 'contact_id');
    }
    public function contact(): HasOne
    {
        return $this->hasOne(Contact::class, 'id', 'contact_id');
    }


Contact Model:
    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class, 'contact_id', 'id');
    }
    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class, 'contact_id', 'id');
    }


My users table has an
contact_id
contact_id
field which should be filled with the created contact. But it isn't.
I think the issue is somewhere in my code but for the love of me im not able to see 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

Relationship not saved when using createOptionUsing on Select input
FilamentFFilament / ❓┊help
2y ago
Model saved event firing twice
FilamentFFilament / ❓┊help
3y ago
Prevent data being saved to model on file/s upload?
FilamentFFilament / ❓┊help
3y ago
Convert model method to eloquent relationship
FilamentFFilament / ❓┊help
2y ago