Laravel-Backpack / community-forum

A workspace to discuss improvement and feature ideas, before they're actually implemented.
28 stars 0 forks source link

Create a listOperation with nested resource #665

Closed Astriel closed 5 months ago

Astriel commented 10 months ago

Hi everyone !

On the V4 of Backpack, if we had a n <> n relationship, for example users and posts, with a user having several posts, it was possible thanks to that tutorial to created a nested liste operation page : https://backpackforlaravel.com/articles/tutorials/nested-resources-in-backpack-crud

Unfortunatly I can't manage to make that work with the V6 of Backpack. I know I can already use some other fields like PRO fields for example, but there is a bug with the relationship field which makes way too much query. In my case, I've got for example a user with 180 posts, and it takes ages to load.

Is there any plan or any way to create a list to view a nested resource + pivot value ? I would also like to use the edit in place in the columns plugin.

Thanks a lot !

promatik commented 10 months ago

Hi @Astriel, let's break it down 🙌

1) Why can't you make it work on v6? It should ...

2) > ... but there is a bug with the relationship field which makes way too much query. In my case, I've got for example a user with 180 posts, and it takes ages to load.

Can you give us more details on this? In order for us to reproduce your issue? @pxpm are you aware of any trouble like this with the relationship field?

3) > ...I would also like to use the edit in place in the columns plugin.

If you are talking about being able to edit entries directly from the list view/datatable, we now have editable columns 🙌

pxpm commented 9 months ago

@promatik AFAIK it's working, but maybe the tutorial is not up-to-date. I've added a nested crud example in demo a few weeks ago: https://github.com/Laravel-Backpack/demo/pull/568

@Astriel the relationship queries is an issue that we are aware and plan to fix, we are not confortable yet with any solutions that we found, sorry for that, we are working on it (in the meanwhile, using ajax partially solves this problem, but I know that's not always desirable).

Let me know if the Nested crud example I provided in the demo link works for you.

@karandatwani92 can you have a look in the mentioned article https://backpackforlaravel.com/articles/tutorials/nested-resources-in-backpack-crud and compare it with the crud I added to demo, and check if everything still hold up ? https://github.com/Laravel-Backpack/demo/pull/568

Cheers

pxpm commented 5 months ago

Beeing addressed in https://github.com/Laravel-Backpack/docs/issues/546