I am doing a small task delivery module. Then, when I make the query that belong to a group.
Show me all the users who made the delivery,
In this way I take care of all the tasks, with their deliveries, in this delivery comes the ID of the user that I give, I could add it. user, but it is not necessary anymore since the Id-user already comes in the delivery.
$tareas = $sala->load('tareas.entregas','users');
Then, where it says USERS. Charge all users belonging to this room.
in this example.
si hay 30 usuarios y 20 tareas. Sabiendo que solo algunos no entregaron todas entonces,
I could say I would go through it with a foreach. but it's been very long, Since.
I should compare. Toda la lista de usuarios
each. if he fulfilled the first task.
Then it's being 600
Repetitions
then doubt arises if there is something better.
that's how the task list is. here I only put one, but there will be more with their respective deliveries.
where it says deliveries comes the user-id
"tareas": [
{
"id": 5,
"titulo": "alaalejayeeee actualizando",
"descripcion": "<p>....</p>",
"sala_id": 1,
"entregar_at": "2018-12-12 03:19:21",
"created_at": "2018-12-12 00:08:44",
"updated_at": "2018-12-12 01:28:13",
"entregas": [
{
"id": 2,
"descripcion": "ddgfkdgfklñdfgkñldfgklñfdgñlfdgfggfdgfdgfdgf",
"cal": 87,
"tarea_id": 5,
"user_id": 4,
"created_at": "2018-12-19 11:12:54",
"updated_at": "2018-12-19 12:09:47"
},
{
"id": 5,
"descripcion": "lmdfsdkfkjdfdkll",
"cal": 89,
"tarea_id": 5,
"user_id": 2,
"created_at": "2013-12-19 12:38:12",
"updated_at": "2018-12-19 12:39:02"
}
]
},
Then there's a more direct way to check since I'm going to fill it in a table, so I need to.
to know if the first user of the user list is in the delivery list of the first task.
I do not know, looking for it inside, as it is done with arrays. look for a particular element and if it exists then we do something.