Field with data from relationship (BelongsTo)

Hi ! I'm trying to display data from my user_profiles table on the 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') 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),


Can someone help me ? Thanks!
image.png
Was this page helpful?