public static function getProductsForm()
{
return [
Forms\Components\Repeater::make('orderProducts')
->relationship('orderProducts')
->schema([
Forms\Components\Select::make('product_id')
->relationship('product', 'name',
modifyQueryUsing: fn (Builder $query) => $query->enabled())
->live()
->searchable()
->preload()
[....]
]),
Forms\Components\TextInput::make('discount')
->numeric()
->rules(['regex:/^\d{1,6}(\.\d{0,2})?$/'])
->minValue(0)
->suffix('€'),
Forms\Components\TextInput::make('total')
->label('Total')
->disabled()
->readOnly()
->dehydrated(false)
];
}
public static function getProductsForm()
{
return [
Forms\Components\Repeater::make('orderProducts')
->relationship('orderProducts')
->schema([
Forms\Components\Select::make('product_id')
->relationship('product', 'name',
modifyQueryUsing: fn (Builder $query) => $query->enabled())
->live()
->searchable()
->preload()
[....]
]),
Forms\Components\TextInput::make('discount')
->numeric()
->rules(['regex:/^\d{1,6}(\.\d{0,2})?$/'])
->minValue(0)
->suffix('€'),
Forms\Components\TextInput::make('total')
->label('Total')
->disabled()
->readOnly()
->dehydrated(false)
];
}