Domain\Classroom\ClassroomRepository::associateStudents PHP Méthode

associateStudents() public méthode

Associate students.
public associateStudents ( Classroom $classroom, array $students )
$classroom Classroom
$students array
    public function associateStudents(Classroom $classroom, array $students)
    {
        $ids = [];
        foreach ($students['students'] as $student) {
            $ids[] = $student['id'];
        }
        $classroom->students()->sync($ids);
    }