Pivot column in many to many relationship - form builder
i have the following form:
Forms\Components\Section::make('Linked Businesses')
->schema([
Forms\Components\Select::make('businesses')
->relationship('businesses', 'name')
->multiple()
->disabled(fn ($record) => Auth::user()->role === 'business_owner'),
TextInput::make('discount_percentage') // TODO: THIS IS NOT WORKING
->label('Discount Percentage')
->numeric()
->minValue(0)
->maxValue(100)
->required()->disabled(fn ($record) => Auth::user()->role === 'business_owner'),
]),
I want to add the TextInput of discount_percentage to the create form so i can save it in the same form when i choose the business, how can i make it possible without having the following approach in the relationship manager:
Tables\Actions\AttachAction::make()
->form(fn (AttachAction $action): array => [
$action->getRecordSelect(),
Forms\Components\TextInput::make('discount_percentage')->required(),
])
])
0 Replies