Are there any eloquent solutions to handle many to many relationships in forms?
Example: Post has many Tags and a Tag can belong to many posts.
My thought is, there must be a way to use a multi-select in a form to accomplish this.
Are there any eloquent solutions to handle many to many relationships in forms?
Example: Post has many Tags and a Tag can belong to many posts.
My thought is, there must be a way to use a multi-select in a form to accomplish this.
@ScottR Yes.
Here's an example.
There are three table in a SQL database.
My objective:
Solutions:
Possible Solution:
I think the last option is best. Keep it simple and build the base to you set the right relationships between tables.
I use the last one with a twist. I use a transaction within a stored procedure in my database so I don't end up with orphaned records if something goes wrong halfway through. Then I can also just use the one query in Retool keeping things cleaner and easier.
I pass the main table ID and the .value array from the multiselect ad let the SP do the dirty work. If you need an example I can send one along (I think I have a post here that goes into this more detail somewhere can't find it at the moment.)