C
C
chelkaz2019-01-10 20:45:04
Laravel
chelkaz, 2019-01-10 20:45:04

What connection in Laravel should be used if some user groups need to add tasks?

On the site, the user has the opportunity to select a certain group from the drop-down list.
And get her a job. More than one task can be created for each such group, and several photos can be attached to the task.
I now have a table with groups for users, for example with active ( active ) user_id 2:
user_id group_name active
1 artist null
2 ​​market true
3 book null
There is a table with photos
How can I create links so that I can create some records (tasks) to which you can attach several photos from the table and which store the active group.
As a result, the user should get something like this:
--- Task for the market group
photo 1
photo 2
photo 3
photo 4
--- Task for the market group -2
photo 1
photo 2
photo 3
photo 4
--- Task for the book group
photo 1
photo 2
pics 3
pics 4
and so on...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jazzus, 2019-01-11
@jazzus

Create connection tables between all entities in the relationship, make a connection in the many-to-many models and then make records in the connection tables through the ->attach() method

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question