Code Monkey home page Code Monkey logo

Comments (8)

jamessessford avatar jamessessford commented on September 4, 2024 1

Thanks for checking it out @lukas-frey

What's the use case actually here? Why do you need to disable scoping on the PageResource? It belongs to a document, which is scoped to a tenant anyways, so it will still be scoped to a tenant via this relationship. Is it really necessary to have it disabled? Maybe I'm missing something.

Not entirely needed no - I'm was just trying to keep the database smaller and because a document already belonged to a tenant, it seemed a wasted field to also include it on the pages. They can only be browsed via the DocumentResource so didn't need to be scoped.

Anyways, your best bet for now is to override the handleRecordCreation method in your CreateDocumentPage class and replace the static::getResource() call with the actual resource (PageResource) in your case.

Thanks, I'll give this a shot when I'm looking at it again.

from filament-nested-resources.

lukas-frey avatar lukas-frey commented on September 4, 2024

@jamessessford Hi, thanks for the bug report. Can you provide a test repository with the bug? I tried reproducing it as you described and I can disable tenant scoping without an issue.

from filament-nested-resources.

jamessessford avatar jamessessford commented on September 4, 2024

I will bud! Is there any chance you can put the test repo you've made up to see if I've just made a mistake?

from filament-nested-resources.

jamessessford avatar jamessessford commented on September 4, 2024

Sorry it took a little longer than I expected @lukas-frey - the test repo is available at https://github.com/jamessessford/nested-resource-bug

from filament-nested-resources.

lukas-frey avatar lukas-frey commented on September 4, 2024

Sorry it took a little longer than I expected @lukas-frey - the test repo is available at https://github.com/jamessessford/nested-resource-bug

Thanks for the repo. The issue is that you're trying to set one of the child nested resources (not the root nested resource) as not scoped. However, since the CreateDocumentPage is a DocumentResource page, not a PageResource page, it uses the isScopedToTenant setting from DocumentResource, not PageResource (CreateRelatedRecord class line 184).

Currently there's no easy way for me to know the related resource without introducing another property you need to manually set in each page, which is not something I'm too inclined to do right now.

What's the use case actually here? Why do you need to disable scoping on the PageResource? It belongs to a document, which is scoped to a tenant anyways, so it will still be scoped to a tenant via this relationship. Is it really necessary to have it disabled? Maybe I'm missing something.

Anyways, your best bet for now is to override the handleRecordCreation method in your CreateDocumentPage class and replace the static::getResource() call with the actual resource (PageResource) in your case.

from filament-nested-resources.

jamessessford avatar jamessessford commented on September 4, 2024

@lukas-frey - I think I've fixed this in my local version - are you happy if I raise a pull request for you to have a look at?

from filament-nested-resources.

lukas-frey avatar lukas-frey commented on September 4, 2024

@lukas-frey - I think I've fixed this in my local version - are you happy if I raise a pull request for you to have a look at?

Sure, you're more than welcome to create a PR and I'll have a look! :)

from filament-nested-resources.

jamessessford avatar jamessessford commented on September 4, 2024

Thanks, @lukas-frey

#32

from filament-nested-resources.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.