diff --git a/readme.md b/readme.md index 003ef8f..e3e15f6 100644 --- a/readme.md +++ b/readme.md @@ -543,6 +543,7 @@ $attendance = new \Wonde\Writeback\LessonAttendanceRecord(); $attendance->setStudentId('STUDENT_ID_GOES_HERE'); $attendance->setLessonId('LESSON_ID_GOES_HERE'); $attendance->setAttendanceCodeId('ATTENDANCE_CODE_ID_GOES_HERE'); +$attendance->setComment('Comment here.'); // Add attendance mark to register $register->add($attendance); diff --git a/src/Writeback/LessonAttendanceRecord.php b/src/Writeback/LessonAttendanceRecord.php index 66377e0..9595b34 100644 --- a/src/Writeback/LessonAttendanceRecord.php +++ b/src/Writeback/LessonAttendanceRecord.php @@ -19,6 +19,11 @@ class LessonAttendanceRecord */ private $attendance_code_id; + /** + * @var string + */ + private $comment; + /** * Set student id * @@ -114,7 +119,33 @@ public function toArray() 'attendance_code_id' => $this->getAttendanceCodeId() ]; + $comment = $this->getComment(); + + if ( ! empty($comment)) { + $required['comment'] = $comment; + } + return $required; } -} \ No newline at end of file + /** + * Get the comment value + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Set the comment value + * + * @param string $comment + */ + public function setComment($comment) + { + $this->comment = $comment; + } + +}