I have two different collections from 2 eloquent requests ($training_sessions & $users_count)
My first collection is giving me information for training sessions :
2 => {#464 ▼
+"date": "2018-02-24"
+"id": 4
+"debutsession": "13:30:00"
+"finsession": "17:00:00"
+"creneau": "13:30:00 - 17:00:00"
+"created_at": null
+"updated_at": null
+"nom": "MYNAME"
+"prenom": "MYSURNAME"
+"salle": "ROOM NAME "
+"sessions": "SESSION NAME"
And i have a second Collection which gives me a count of users that will participate to the session
0 => {#564 ▼
+"id": 2
+"userscount": 4
}
1 => {#562 ▼
+"id": 3
+"userscount": 1
}
I tried to find out which method would allow me to create a single collection which would give me for each training session the number of attendees i get from the second collection (field userscount)
For example for id = 2:
2 => {#464 ▼
+"date": "2018-02-24"
+"id": 2
+"debutsession": "13:30:00"
+"finsession": "17:00:00"
+"creneau": "13:30:00 - 17:00:00"
+"created_at": null
+"updated_at": null
+"nom": "MYNAME"
+"prenom": "MYSURNAME"
+"salle": "ROOM NAME "
+"sessions": "SESSION NAME"
+"userscount": 1
}
And for a session without any attendee i would have :
2 => {#464 ▼
+"date": "2018-02-24"
+"id": 2
+"debutsession": "13:30:00"
+"finsession": "17:00:00"
+"creneau": "13:30:00 - 17:00:00"
+"created_at": null
+"updated_at": null
+"nom": "MYNAME"
+"prenom": "MYSURNAME"
+"salle": "ROOM NAME "
+"sessions": "SESSION NAME"
+"userscount": 0
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2uteNMg
via IFTTT
Aucun commentaire:
Enregistrer un commentaire