-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nesting repeaters for BelongsToMany relationships #13069
Labels
Milestone
Comments
that was the same for me if you have a solution for this ,pldas My Resource
my migration
my seeder
|
Not sure if I’m having the same issue, but here: app/Models/Guide.php public function items(): BelongsToMany
{
return $this->belongsToMany(Item::class);
} Forms\Components\Repeater::make('steps')
->schema([
Forms\Components\Select::make('item')
->relationship(name: 'items', titleAttribute: 'title')
->disableOptionsWhenSelectedInSiblingRepeaterItems()
->required(),
Forms\Components\Textarea::make('description')
->autosize(),
]), Desired behaviour: Current behaviour: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Package
filament/filament
Package Version
v3.2
Laravel Version
v11.9
Livewire Version
v3.5
PHP Version
PHP 8.3
Problem description
Following the example of using a repeater to fill BelongsToMany relationships [https://filamentphp.com/docs/3.x/forms/fields/repeater], I want to nest two repeaters with BelongsToMany relationships to handle a scenario like this:
I have Orders that have Products, which in turn have Colors.
I'm encountering a bug during the initial save: the color is not saved correctly because the order_product_id column in the color_order_product table is null. However, if I add new colors to a product in the order afterward, the modification is saved correctly.
But if I add a new product, the same issue arises.
Expected behavior
When creating an order, adding products, and assigning colors to those products using the nested repeater, all entries should be saved correctly.
Steps to reproduce
Create an order with products and assign colors to those products using the nested repeater.
Save the order.
Check the color_order_product table and observe that the order_product_id column is null for the initially added colors.
Add new colors to the existing product and save again. Observe that these new colors are saved correctly.
Add a new product to the order and assign colors. Save and observe the issue reoccurs.
Reproduction repository
https://github.com/marc31/filament-nested-repeater-w-relationship
Relevant log output
No response
Donate 💰 to fund this issue
The text was updated successfully, but these errors were encountered: