add new row in multiple database table from a single model #561
-
I have a location table which contains some fields and I have created local crud in laravel backup. Now I want to add three entries in different database tables from same location model. i.e Table: Location CRUD already created for this table. Table: partners: Table: courier Can you please guide how can I do this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @lovelyarora24 I ever asked this question before, about insert to another table from 1 form, they suggested me to use "model event" or "extend the insert operation", check this out, maybe the best one is to use model event also, I have another opinion, maybe I need to make my own custom operation to handle this unique case, this is the best for me, so far this is the example of how we do that custom operation but still use the great power field from backpack Sorry for my English, I hope u found it useful, let me know If you have another question mate, cheers |
Beta Was this translation helpful? Give feedback.
Hi @lovelyarora24 I ever asked this question before, about insert to another table from 1 form, they suggested me to use "model event" or "extend the insert operation", check this out, maybe the best one is to use model event
https://backpackforlaravel.com/docs/5.x/release-notes#use-model-events-inside-crudcontrollers
also, I have another opinion, maybe I need to make my own custom operation to handle this unique case, this is the best for me, so far
https://backpackforlaravel.com/docs/5.x/crud-operations#creating-a-custom-operation-1
this is the example of how we do that custom operation but still use the great power field from backpack
https://backpackforlaravel.com/articles/tutorials/h…