FilamentF
Filament16mo ago
kalesha

text input with relation

when i try to access pricing relation with product model, i could not access values in the form text input. can some one help me how to get relation model value with text input ???

TextInput::make('pricing.sell_price')
->label('Price')
->required()
->numeric()
->helperText('Enter price of the product')
->default(fn ($record) => $record?->pricing?->base_price),

product model

public function pricing(): HasOne
{
return $this->hasOne(ProductPricing::class);
}
Solution
You need to use a Layout field with ->relationship() for this
Was this page helpful?