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
awcodes2y 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
.najibahmedOP2y ago
In another words. How to have two forms in one resource?
awcodes
awcodes2y 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
.najibahmedOP2y ago
Make sence. Appriciate your time.

Did you find this page helpful?