Releases: harishdurga/laravel-quiz
Releases · harishdurga/laravel-quiz
Support for Laravel 11
Support for Laravel 10
Namespace Issue Fixed For Topicable Model
v1.2.1
v1.2.0
The validate()
on the QuizAttempt
model fetched answers from the first QuizAttempt rather than the correct QuizAttempt
when there are multiple QuizAttempts for the same Quiz
. The same was the issue with render methods for the three types of questions. This issue got fixed in this release. The render method signature got updated by passing the QuizAttempt
as the second argument and the mixed optional data as the third argument.
Example
public static function renderQuestionType1Answers(QuizQuestion $quizQuestion,QuizAttempt $quizAttempt,mixed $data=null)
{
/**
* @var Question $actualQuestion
*/
$actualQuestion = $quizQuestion->question;
$answers = $quizQuestion->answers->where('quiz_attempt_id', $quizAttempt->id);
$questionOptions = $actualQuestion->options;
$correctAnswer = $actualQuestion->correct_options()->first()?->option;
$givenAnswer = $answers->first()?->question_option_id;
foreach ($questionOptions as $questionOption) {
if ($questionOption->id == $givenAnswer) {
$givenAnswer = $questionOption->option;
break;
}
}
return [$correctAnswer, $givenAnswer];
}
v1.1.12
Package dependencies got updated.
v1.1.11
- Implemented
validate()
method for QuizAttempt model