// 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),