Repeater relationship select

Hello. I've got a PurchaseOrder resource which has a repeater for items. I want to add a select to show all current Products from the database that exist with the ability to add a new product if the user doesn't find the one they're looking for. I know that functionality exists for relationship selects, but how can I implement something similar if there's no relationship (since it's a JSON field). Here's the repeater:
Repeater::make('items')->schema([
// TODO: Select from pre-existing products or create a new one.
TextInput::make('name')->required(),
Grid::make()->schema([
MoneyInput::make('unit_cost')->required()->numeric(),
TextInput::make('tax_rate')->required()->numeric()->suffix('%'),
])->columns()->columnSpan(1),
TextInput::make('quantity')->required()->numeric(),
TextInput::make('received_quantity')->required()->numeric()->placeholder(0)->default(0),
])
Repeater::make('items')->schema([
// TODO: Select from pre-existing products or create a new one.
TextInput::make('name')->required(),
Grid::make()->schema([
MoneyInput::make('unit_cost')->required()->numeric(),
TextInput::make('tax_rate')->required()->numeric()->suffix('%'),
])->columns()->columnSpan(1),
TextInput::make('quantity')->required()->numeric(),
TextInput::make('received_quantity')->required()->numeric()->placeholder(0)->default(0),
])
On the products table, I've got a reference, name, and inventory field.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server