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
Jump to solution
3 Replies
Wrax
Wrax4mo ago
Try explicitly passing the foreignkey on the hasOne method `public function pricing(): HasOne { return $this- >hasOne(ProductPricing::class, 'pricing_id'); }
Solution
Dennis Koch
Dennis Koch4mo ago
You need to use a Layout field with ->relationship() for this
kalesha
kaleshaOP3mo ago
i fixed it using group
Want results from more Discord servers?
Add your server