RelationManager inside modal/sliderOver
Hi there,
I have been browsing the docs, the web, this discord and youtube videos and I can’t seem find what I am looking for.
I have created a CollectionResource associated to my Collection model. A collection has many values (CollectionValue model). I haven’t created a CollectionValueResource as I don’t need it, I only want to be able to CRUD values from the collection itself.
In order to do that I created a relation manager and it works well when I use the edit page generated for my CollectionResource, I have the edit form for the selected collection and the table with collection values appears underneath the form.
But… it’s not what I want. I would like to be able to edit a collection from a slideover. In order to do that, I removed the edit page from the
getPages
method of my CollectionResource and added the slideover
call to the EditAction.
The edit form for the collection now opens in a slideover, but there is no relation manager underneath it, no table to manage collection values.
I have no idea how to use the relation manager inside the slideover nor if it’s even possible…
I have been able to use modalContentFooter
with a Closure to get the Action, the livewire Component, the Collection record, etc. but I don’t know how to return a view that would show the relation manager for the selected collection.
Thanks7 Replies
relation manager is available in Edit or View page..
Honestly, I don't know if it would work, but if you want to try this, you could create a custom livewire component with a table and add this in the modal content.
Hi, thanks for the quick answer.
Yeah I came to that conclusion as well but I’ll have to learn how livewire works before that 😅
Only been using Laravel as a REST API or with Inertia until now.
Any particular reason why the buit-in EditAction is different when you are using an EditPage or a slideover ? I haven’t been able to figure out how does filament « know » when to call the edit page when it is returned in the
getPages
method or use modal/slideover when it’s not, all of that while using the same action ?I think in the
ListRecords
, in the configureEditAction
method to add a url..
Ah, I have been looking in the wrong place then.
Wouldn’t it be possible to create a table action that would use the existing EditPage livewire component (I think that’s a livewire component right ?) and passing whatever data it needs in the view ?
hum, not sure what you are trying to do..
Short version: include the EditPage inside a slideover.
Load the corresponding view via the modalContent method of the action and pass it whatever data it needs, including the relation manager, assuming you can get it from the closure in some way.
hum, I don't know