Laravel-Backpack / addons

A place for the Backpack community to talk about possible Backpack add-ons.
5 stars 2 forks source link

[PRO] Relationship with inline_create inside Relationship with inline_create does not work #37

Closed skpr-repo closed 1 year ago

skpr-repo commented 2 years ago

Bug report

What I did

I have

USER has many PHONES Each PHONE belongs to only one USER Each PHONE belongs to only one MODEL (Apple, Samsung, ecc)

Inside the UserCrudController -> setupCreateOperation I created a relationship field with inline_create and subfields to add phones.

One of the subfields is a relationship with inline_create and subfields (inception!).

What I expected to happen

I would like to use a relationship field that let me add phones to users and a model to each phone, with inline creation in both steps.

What happened

It shows the "add" button inside the second relationship (phone > models), but nothing happens.

What I've already tried to fix it

If I add a relationship without inline_create and subfields, the select2 appears and it works, but I have to add models before adding phones.

Probably I'm pushing the relationship field beyond it's limit. But it would be nice to have such a feature.

Maybe there is another way to achieve the same result?

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP 8.1.7 (cli) (built: Jun 10 2022 12:22:48) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.7, Copyright (c) Zend Technologies with Zend OPcache v8.1.7, Copyright (c), by Zend Technologies

LARAVEL VERSION:

v9.20.0@c99868f1c9bf2f5d250993121838db905591864f

BACKPACK VERSION:

5.1.4@4539c787a2e052d2e2e2c00188c38432dc2a7ea9

Operating System and Server Setup

I encountered the problem above on my Windows 10 machine, Google Chrome latest and my web server is set up using Homestead. MySql 8. composer update to the latest versions. I have a license for backpack pro and devtools.

Thanks

pxpm commented 2 years ago

Hello @skpr-repo please provide you relationship definition and your field definition in the Controller so that we can have a better look of what you are trying to achieve.

Cheers

skpr-repo commented 2 years ago

Hello. I just made an example, my table names and fields are different, so I summarized the main concept of the three tables involved and the error I get.

The question is: is it possible to have a relationship with inline_create and subfields inside another relationship with inline_creation and subfields? If it's not possible, ok, no further inspection is needed.

If it's possible, then maybe I found a bug or maybe I'm doing something wrong. In this case a further inspection could be needed and I will provide all the code :-)

Thanks

skpr-repo commented 2 years ago

The relationship with inline_create shows a repeatable with a list of fields. And it does not work inside another relationship/repeatable. But for what I need, it could work with a select2 + popup that creates new entries into the related table and then selects it, once created.

pxpm commented 1 year ago

I will be closing this as it's known that repeatable over repeatable (relationships with subfields are repeatables) does not work .

You can:

Apart from the unsuported feature, if you have any other issue please open a new ticket so that we can have a look at it.

Cheers