How to insert data into 2 different table from single form. #392
Replies: 4 comments 1 reply
-
1 possible way to handle this is by overriding the create or update method of ur CrudController depending on if you are trying to create or update. Look at the following trait below for an example. If u just use this trait in your CrudController without overriding it, it will be backpack default update behaviour
Then inside ur overridden method, u save to your 2 separate models |
Beta Was this translation helpful? Give feedback.
-
To accomplish what you're trying to obtain, I'd use accessors and mutators for the main CRUD model (Customer), accessors and mutators that retrieve and update the data from and into the customers_general table. More on accessors and mutators: Laravel 8.x, Laravel 9.x. |
Beta Was this translation helpful? Give feedback.
-
Take a look at this documentation or maybe u want to overwrite the store trait, but idk if it's correct, please let me know, because I also use this way and observer, but don't know the correct way, but it works
|
Beta Was this translation helpful? Give feedback.
-
I'm closing this issue due to inactivity. If you need further assistance or have additional questions, feel free to reopen this issue or create a new one. We're here to help! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have used tabs(Basic Details, Applicant Details) in customer crud. I want to store Basic Details (Tab 1) data in the customers_general table & Applicant Details (Tab 2) data in the customers table. Can you please help me here with how I can do it?
Beta Was this translation helpful? Give feedback.
All reactions