diff --git a/app/Models/Category.php b/app/Models/Category.php new file mode 100644 index 0000000..0034167 --- /dev/null +++ b/app/Models/Category.php @@ -0,0 +1,25 @@ +hasMany(Exercise::class, 'category_id'); + } +} diff --git a/app/Models/Exercise.php b/app/Models/Exercise.php new file mode 100644 index 0000000..4332595 --- /dev/null +++ b/app/Models/Exercise.php @@ -0,0 +1,50 @@ +belongsTo(Subject::class, 'subject_id'); + } + + public function category() + { + return $this->belongsTo(Category::class, 'category_id'); + } + + public function skill() + { + return $this->belongsTo(Skill::class, 'skill_id'); + } + + public function questionGroups() + { + return $this->hasMany(QuestionGroup::class, 'exercise_id'); + } + + public function questions() + { + return $this->hasMany(Question::class, 'exercise_id'); + } +} diff --git a/app/Models/ExerciseQuestion.php b/app/Models/ExerciseQuestion.php new file mode 100644 index 0000000..e83becb --- /dev/null +++ b/app/Models/ExerciseQuestion.php @@ -0,0 +1,18 @@ +belongsTo(Exercise::class, 'exercise_id'); + } + + public function group() + { + return $this->belongsTo(QuestionGroup::class, 'group_id'); + } + + public function type() + { + return $this->belongsTo(QuestionType::class, 'question_type_id'); + } + + public function choices() + { + return $this->hasMany(QuestionChoice::class, 'question_id'); + } + + public function blanks() + { + return $this->hasMany(QuestionBlank::class, 'question_id'); + } +} diff --git a/app/Models/QuestionBlank.php b/app/Models/QuestionBlank.php new file mode 100644 index 0000000..235ad61 --- /dev/null +++ b/app/Models/QuestionBlank.php @@ -0,0 +1,24 @@ +belongsTo(Question::class, 'question_id'); + } +} diff --git a/app/Models/QuestionChoice.php b/app/Models/QuestionChoice.php new file mode 100644 index 0000000..a96d9f1 --- /dev/null +++ b/app/Models/QuestionChoice.php @@ -0,0 +1,27 @@ +belongsTo(Question::class, 'question_id'); + } +} diff --git a/app/Models/QuestionGroup.php b/app/Models/QuestionGroup.php new file mode 100644 index 0000000..5f20cd5 --- /dev/null +++ b/app/Models/QuestionGroup.php @@ -0,0 +1,33 @@ +belongsTo(Exercise::class, 'exercise_id'); + } + + public function questions() + { + return $this->hasMany(Question::class, 'group_id'); + } +} diff --git a/app/Models/QuestionType.php b/app/Models/QuestionType.php new file mode 100644 index 0000000..124e3d7 --- /dev/null +++ b/app/Models/QuestionType.php @@ -0,0 +1,24 @@ +hasMany(Question::class, 'question_type_id'); + } +} diff --git a/app/Models/Skill.php b/app/Models/Skill.php new file mode 100644 index 0000000..fbdf0ee --- /dev/null +++ b/app/Models/Skill.php @@ -0,0 +1,23 @@ +hasMany(Exercise::class, 'skill_id'); + } +} diff --git a/app/Models/Subject.php b/app/Models/Subject.php new file mode 100644 index 0000000..44c8f7f --- /dev/null +++ b/app/Models/Subject.php @@ -0,0 +1,10 @@ +