How to get value of other TextEntry inside RepeatableEntry?

RepeatableEntry::make('properties')
->schema([
Grid::make(2)
->schema([
TextEntry::make('construction_id')
->formatStateUsing(fn (string $state): string => (Construction::find($state)?->name ?? 'Stage has been deleted'))
->inlineLabel()->label(false),
TextEntry::make('percent')
->inlineLabel()->label(false),
])
])
RepeatableEntry::make('properties')
->schema([
Grid::make(2)
->schema([
TextEntry::make('construction_id')
->formatStateUsing(fn (string $state): string => (Construction::find($state)?->name ?? 'Stage has been deleted'))
->inlineLabel()->label(false),
TextEntry::make('percent')
->inlineLabel()->label(false),
])
])
How can I check construction_id value within percent entry ?
5 Replies
krekas
krekas6mo ago
Your query in the construction_id looks like a potential n+1 problem Getting value in other textentry should work using $get() Or from the current record
fantastique2233
fantastique2233OP6mo ago
Could you please share an example how to use $get() inside infolist? I had an error when I tried to use it
krekas
krekas6mo ago
First thing fix your n+1 problem... as for $get I said it should, haven't tried
fantastique2233
fantastique2233OP6mo ago
I'll completely remove the line with construction_id if I can find a way to check it's value from percent entry
krekas
krekas6mo ago
Try getting from the record
Want results from more Discord servers?
Add your server