© 2026 Hedgehog Software, LLC

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

Field with data from relationship (BelongsTo)

Hi ! I'm trying to display data from my
user_profiles
user_profiles
table on the
User
User
resource page but it doesn't work and I can't find why. Relationships are defined on both models and I used
->relatonship('profile')
->relatonship('profile')
on my section.

// On the UserProfile.php model
public function user(): HasOne
{
    return $this->hasOne(User::class);
}
// On the User.php model
public function profile(): BelongsTo
{
    return $this->belongsTo(UserProfile::class);
}
// On my UsersResource.php resource
Forms\Components\Section::make('Profil')
    ->relationship('profile')
    ->schema([
        Forms\Components\TextInput::make('country_code')
    ])
    ->columns(2),
// On the UserProfile.php model
public function user(): HasOne
{
    return $this->hasOne(User::class);
}
// On the User.php model
public function profile(): BelongsTo
{
    return $this->belongsTo(UserProfile::class);
}
// On my UsersResource.php resource
Forms\Components\Section::make('Profil')
    ->relationship('profile')
    ->schema([
        Forms\Components\TextInput::make('country_code')
    ])
    ->columns(2),


Can someone help me ? Thanks!
image.png
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

Associate BelongsTo relationship
FilamentFFilament / ❓┊help
3y ago
belongsTo `Placeholder::` field
FilamentFFilament / ❓┊help
3y ago
Relationship Manager for BelongsTo and HasMany Relationship
FilamentFFilament / ❓┊help
2y ago
Relationship search in belongsTo select
FilamentFFilament / ❓┊help
3y ago