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
Wrax2mo 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 Koch2mo ago
You need to use a Layout field with ->relationship() for this
kalesha
kalesha5w ago
i fixed it using group
Want results from more Discord servers?
Add your server