How to have a form save data into two tables?

I have a postResource with a create form which save data in two tables. first table for post information and another for images table. posts table does not have any id for images table. Instead media table has an id for post_id. When click create/save button then each data goes to their own table. I don't want to use media-library. #form-builder
5 Replies
awcodes
awcodes15mo ago
There are lifecycles hook where you can tell the create / edit what to do with the data. Honestly, it does sound like you’re doing it backwards to me and a media library makes more sense.
.najibahmed
.najibahmedOP15mo ago
In another words. How to have two forms in one resource?
awcodes
awcodes15mo ago
It’s not a resource thing. But is doable. A resource can’t have two models. That doesn’t make sense but it they have a relationship then you have free reign to do what you want with them.
.najibahmed
.najibahmedOP15mo ago
Make sence. Appriciate your time.
Want results from more Discord servers?
Add your server