F
Filament4mo ago
shaan

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),
this is my repeater, this is stockrequest_table, so i want to deduct quantity_issued from stock tables quantity and overwrite it. Have tried alot. is it possible with json?
2 Replies
toeknee
toeknee4mo ago
mutatebeforesave and update the stock on save?
shaan
shaan3mo ago
I will try. Thank you
Want results from more Discord servers?
Add your server