Section::make(__('Attributes'))
->schema([
Grid::make(3)
->schema(function (Get $get): array {
$schema = [];
$attributes = CategoryAttribute::query()
->where('category_id', $get('category_id'))
->with('options')
->select('id', 'name')
->get();
foreach ($attributes as $attribute) {
$schema[] = Select::make("attributes.$attribute->id")
->required()
->label($attribute->name)
->options($attribute->options->pluck('name', 'id'))
->searchable();
}
return $schema;
})
])
->key('attributes'),
Section::make(__('Attributes'))
->schema([
Grid::make(3)
->schema(function (Get $get): array {
$schema = [];
$attributes = CategoryAttribute::query()
->where('category_id', $get('category_id'))
->with('options')
->select('id', 'name')
->get();
foreach ($attributes as $attribute) {
$schema[] = Select::make("attributes.$attribute->id")
->required()
->label($attribute->name)
->options($attribute->options->pluck('name', 'id'))
->searchable();
}
return $schema;
})
])
->key('attributes'),