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
17.65k stars 2.76k forks source link

Nested relationships not working on creation. #6039

Closed danielbehrendt closed 1 year ago

danielbehrendt commented 1 year ago

Package

filament/filament

Package Version

v2.17.18

Laravel Version

v10.4.1

Livewire Version

No response

PHP Version

PHP 8.2.4

Problem description

When trying to create a new model with 2 level nested relations only the first level gets saved.

The nested structure is as followed:

-> user --> person ---> contact

All these relations are defined by morphOne relationships.

Expected behavior

After saving the new model only user and person exist but the expected behavior would be the have a user with a person and a contact belonging to the person.

In case of edit it works but not in case of create.

Steps to reproduce

Download "Reproduction repository" and run

composer install

Edit .env file and the run

php artisan migrate
php artisan make:filament-resource User

Login in to Filament admin and try to create e new user.

Reproduction repository

https://github.com/danielbehrendt/filament-test

Relevant log output

No response

danharrin commented 1 year ago

Fixed by #6092.

zepfietje commented 1 year ago

Has this issue been reopened on purpose, @danharrin?

danharrin commented 1 year ago

Yes apparently it didnt fix

danharrin commented 1 year ago

I just downloaded the same repository again, I was pretty sure the issue was fixed last time I closed it but this was reported.

I see no issues with the behaviour. I have attached a screen recording.

https://user-images.githubusercontent.com/41773797/235364316-8904a9f2-c0fd-4e8e-a3a1-8a6cd95b95b8.mov

@danielbehrendt please double check you're on the latest Filament version. Make sure no versions are locked in your composer.json. Run artisan about to check the Filament version. If the issue persists, please create another reproduction in a fresh Laravel project because this one is not helping me.

danharrin commented 1 year ago

Btw - I tested it with the latest 2.x branch. Potentially #6363 fixed the problem. So it's worth updating to the latest version of Filament before testing, it could be that 👍

JonatasBSM commented 1 month ago

It should work at filament 3? Im having the same problem with belongsTo nested relations

mangtri99 commented 1 month ago

This issue still happen on version 3

danharrin commented 1 month ago

We investigate open issues with reproduction repositories, if you open one we will look at it