Domain\Classroom\ClassroomRepository::associateMatters PHP Method

associateMatters() public method

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