Collapse sections based on resource

I have 2 resources that use the same model, but on one of them i need to open the form with some collapsed sections, how can i check wich resource is opening the form so i can make collapse true?
6 Replies
Dennis Koch
Dennis Kochβ€’2y ago
Since you have two resources, which are separate classes, why do you need a check?
tiago.pereira
tiago.pereiraOPβ€’2y ago
i dont want to duplicate the form on both places, the second one will have parts of the first form but collapsed, then i have a custom view that adds some stuff bellow the form but the user can click to open the sections right now i have the form duplicated but everytime i need to change something on the form need to do it in both places, if i can make a function to check wich resource is opening the form i can make the collapsed dynamic and use the same form for both
Dennis Koch
Dennis Kochβ€’2y ago
I don't think there is a way to check the resource. You could check the page you are on. I can only think about identifiying the resource via the URL
Patrick Boivin
Patrick Boivinβ€’2y ago
Maybe this:
->collapsed(fn ($livewire) => $livewire instanceof Pages\EditItem)
->collapsed(fn ($livewire) => $livewire instanceof Pages\EditItem)
Dennis Koch
Dennis Kochβ€’2y ago
This should work if you have separate pages for both and are not trying to reuse pages aswell πŸ˜…
tiago.pereira
tiago.pereiraOPβ€’2y ago
perfect i think its this let me check Thanks a lot @pboivin its working
Want results from more Discord servers?
Add your server