filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.41k stars 2.87k forks source link

MorphMany RelationManager can only associate one item #11205

Closed DevRaeph closed 6 months ago

DevRaeph commented 8 months ago

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 commented 8 months ago

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: @.***>

marcosmarcolin commented 8 months ago

Correct @DevRaeph,

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