Preload Resource data for form

Is it possible to preload data for a resource? I have 2 Repeaters nested and that makes 14 queries with 1 item. Can i preload? Filament: 3.0.86
$form
->schema([
Forms\Components\TextInput::make('name')
->columnSpan(3),
Forms\Components\Repeater::make('days')
->relationship()
->label('Days')
->orderColumn('day')
->schema([
Forms\Components\Repeater::make('nutrients')
->label('Nutrients')
->relationship()
->schema([
Forms\Components\TextInput::make('parts'),
Forms\Components\Select::make('nutrient_id')
->options($nutrients->pluck('name', 'id'))
]),
Forms\Components\Repeater::make('oncePerDayNutrients')
->relationship()
->schema([
Forms\Components\TextInput::make('ml'),
Forms\Components\Select::make('nutrient_id')
->label('Nutrient')
->options($nutrients->pluck('name', 'id'))
]),
Forms\Components\Repeater::make('lights')
->relationship()
->schema([
Forms\Components\Select::make('light_id')
->label('Light')
->options($lights->pluck('name', 'id'))
])
])
]);
$form
->schema([
Forms\Components\TextInput::make('name')
->columnSpan(3),
Forms\Components\Repeater::make('days')
->relationship()
->label('Days')
->orderColumn('day')
->schema([
Forms\Components\Repeater::make('nutrients')
->label('Nutrients')
->relationship()
->schema([
Forms\Components\TextInput::make('parts'),
Forms\Components\Select::make('nutrient_id')
->options($nutrients->pluck('name', 'id'))
]),
Forms\Components\Repeater::make('oncePerDayNutrients')
->relationship()
->schema([
Forms\Components\TextInput::make('ml'),
Forms\Components\Select::make('nutrient_id')
->label('Nutrient')
->options($nutrients->pluck('name', 'id'))
]),
Forms\Components\Repeater::make('lights')
->relationship()
->schema([
Forms\Components\Select::make('light_id')
->label('Light')
->options($lights->pluck('name', 'id'))
])
])
]);
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server