Dot notation in form edit
I know this should be easy. I use dot notation in my table. Property model has a serivce_id and service model has a price. So in my property resource I use
service.price
no problem. In my form I want this to be a computed property. The default will be the same service.price
but that just leaves the field blank. I thought I'd compute with pricing add ons after that but I can't get that initial field to fill.
I thought I could do:
Forms\Components\TextInput::make('service.price')
->disabled()
->dehydrated(false),
But it just remains blank.Solution:Jump to solution
Dot notation doesn’t work for form names. You would need to wrap the input in a layout container that supports relationships. Then the layouts schema can be scoped to the relationship.
So Layout::make(‘service’)->relationship() and TextInput::make(‘price’)...
2 Replies
Solution
Dot notation doesn’t work for form names. You would need to wrap the input in a layout container that supports relationships. Then the layouts schema can be scoped to the relationship.
So Layout::make(‘service’)->relationship() and TextInput::make(‘price’)
Disappointing. But at least I'm not crazy LOL
Kind of surprised this is the first time I've run into this.
Thanks!