Create related record inside infolist
How can I create a record of another model inside a infolist using an action button?
I have a infolist in my "BookingResource", I want that button to create a "Invoice" (Booking and Invoice are related), how can I do that? with a modal if possible.
I'm trying to do something like this but it's not working:
The motive is that I need the booking to have a invoice featured before I can complete the booking, if there's a better a way to do this, let me know
Solution:Jump to solution
ok, I've made an Action like this:
```php
Action::make('createInvoice')
->form(InvoiceForm::getForm(true))...
5 Replies
anyone?
what isn't working?
Actually, I just don't know how to create a invoice related to that booking, from the infolist, for example, I want button "create invoice" to create a invoice directly related to that booking, but I don't know how to do that
I think the
->form()
method in the Action
don't work, because I can't chain a ->relationship
method on itSolution
ok, I've made an Action like this:
in that
getForm
method, I've added a param to prevent relationship errors by hiding some fields.
The problem was that I didn't want to make different forms for the same thing, so now I have only one form that I can make a few changes if I pass that paramthanks anyway Leandro π