Filamentphp Repeaters
php Repeater::make('items')
->relationship('items')
->schema([
Select::make('stock_id')
->label('Product')
->searchable()
// ->options(Stock::pluck('product_name', 'id'))
->options(function () {
return Stock::get()->mapWithKeys(fn($product
) => [$product->id => "{$product->product_name} (Available: {$product->quantity})"]);
})
->required()
->reactive(),
TextInput::make('quantity_requested')
->numeric()
->required(),
TextInput::make('quantity_issued')
->numeric()
->required()
->reactive()
->visible(),
])
->columns(3),
php Repeater::make('items')
->relationship('items')
->schema([
Select::make('stock_id')
->label('Product')
->searchable()
// ->options(Stock::pluck('product_name', 'id'))
->options(function () {
return Stock::get()->mapWithKeys(fn($product
) => [$product->id => "{$product->product_name} (Available: {$product->quantity})"]);
})
->required()
->reactive(),
TextInput::make('quantity_requested')
->numeric()
->required(),
TextInput::make('quantity_issued')
->numeric()
->required()
->reactive()
->visible(),
])
->columns(3),
2 Replies