can I perform multi insert on my model? #484
Replies: 2 comments 7 replies
-
Hi @christmex did you try add to this the "model"
Let me know if thats works for you. Cheers. |
Beta Was this translation helpful? Give feedback.
1 reply
-
@christmex the error message is a bit weird to me:
Where is this error happening more exactly? Are you sure this isn't some custom code that's triggering this error? What does your full error stack look like? Because Laravel is using Flare, once you get that error you should be able to "share" your entire error stack - it'll give you a link you can give us, so we have a picture of WHERE that error is happening. Cheers! |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys so I have a question, can I perform multi-insert on my current model, I will provide my ERD and the scenario detail.
here's my ERD

here's my form

when I try to insert it, it will show an error, like this

here's my specific setupcreateoperation()

little explanation, I have a transactions table that is related to a few tables, but it doesn't really matter, except for the books table, the scenario is, I want to choose more than one book from my create form, the school_year_id, semester_id,member_id they're all same and the value is not multiple just one value, so if I choose multiple books, then it will insert all the book with another data is same the difference is just the book_id, I hope you understand my question.
so, like the $data, I will choose more than one book and I want to insert them at one time
should I make a new operation? or there is a way that I can use for this case? or anything? let me know, thanks for your attention
I also trying to read all of this but still, not that understand if it's the way or not
https://backpackforlaravel.com/docs/5.x/crud-how-to#hasmany-1-n-relationship
https://backpackforlaravel.com/docs/5.x/crud-fields#select_multiple-n-n-relationship
Beta Was this translation helpful? Give feedback.
All reactions