filament icon indicating copy to clipboard operation
filament copied to clipboard

MorphMany RelationManager can only associate one item

Open DevRaeph opened this issue 1 year ago • 2 comments

Package

filament/filament

Package Version

v3.2.22

Laravel Version

v10.43.0

Livewire Version

No response

PHP Version

8.3

Problem description

I've tried to create a MorphTo Model called Vehicle with the morph attribute named owner. Then I have to MorphMany models called Customer and Carrier. Both should be able to have multiple vehicle. I've tried to implement the relation manager on the Customer resource to associate the vehicles. After the first association I can't associate another one. The Select field stays empty.

Expected behavior

I expected that i can associate more models one after another.

Steps to reproduce

Pull repo, then create a user and log in. Create 2 vehicles and one customer. Edit the customer and try to associate a vehicle, after that try to associate anoter one.

Reproduction repository

https://github.com/DevRaeph/filament-morph-many-relation

Relevant log output

No response

DevRaeph avatar Feb 01 '24 09:02 DevRaeph

Yes i tried allowing duplicates, that also changed nothing.

Marcos Marcolin @.***> schrieb am Do. 1. Feb. 2024 um 12:45:

Hi @DevRaeph https://github.com/DevRaeph,

I haven't been able to simulate your project locally yet, but have you tried allowing duplicates? https://filamentphp.com/docs/3.x/panels/resources/relation-managers#handling-duplicates

Maybe that could be it.

— Reply to this email directly, view it on GitHub https://github.com/filamentphp/filament/issues/11205#issuecomment-1921140153, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN6Y5WOUJHYHF55GW6VLYILYRN54TAVCNFSM6AAAAABCUSDP6OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRRGE2DAMJVGM . You are receiving this because you were mentioned.Message ID: @.***>

DevRaeph avatar Feb 01 '24 12:02 DevRaeph

Correct @DevRaeph,

I ended up deleting the answer because I realized I was wrong, it refers to the table, not the form.

marcosmarcolin avatar Feb 01 '24 14:02 marcosmarcolin