uawdijnntqw1x1x1
IP : 216.73.216.93
Hostname : panel.codeskitter.com
Kernel : Linux panel.codeskitter.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
Disable Function : apache_child_terminate, apache_note, apache_setenv, define_syslog_variables, dl, link, opcache_get_status, openlog, pcntl_exec, pcntl_fork, pcntl_setpriority, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid
OS : Linux
PATH:
/
home
/
users
/
unlimited
/
www
/
learnoid.codeskitter.site
/
database
/
factories
/
QuestionFactory.php
/
/
<?php namespace Database\Factories; use App\Enum\QuestionTypeEnum; use App\Repositories\ExamRepository; use App\Repositories\QuizRepository; use Illuminate\Database\Eloquent\Factories\Factory; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Question> */ class QuestionFactory extends Factory { /** * Define the model's default state. * * @return array<string, mixed> */ public function definition(): array { $questionType = QuestionTypeEnum::cases()[array_rand(QuestionTypeEnum::cases())]; switch ($questionType) { case QuestionTypeEnum::MULTIPLE_CHOICE: $options = [ 'option_1' => [ 'text' => fake()->sentence(), 'is_correct' => fake()->boolean(), ], 'option_2' => [ 'text' => fake()->sentence(), 'is_correct' => fake()->boolean(), ], 'option_3' => [ 'text' => fake()->sentence(), 'is_correct' => fake()->boolean(), ], 'option_4' => [ 'text' => fake()->sentence(), 'is_correct' => fake()->boolean(), ], ]; break; case QuestionTypeEnum::SINGLE_CHOICE: $options = [ 'option_1' => [ 'text' => fake()->sentence(), 'is_correct' => false, ], 'option_2' => [ 'text' => fake()->sentence(), 'is_correct' => false, ], 'option_3' => [ 'text' => fake()->sentence(), 'is_correct' => false, ], 'option_4' => [ 'text' => fake()->sentence(), 'is_correct' => true, ], ]; break; case QuestionTypeEnum::BINARY: $options = [ 'yes' => [ 'is_correct' => false, ], 'no' => [ 'is_correct' => true, ], ]; break; } $owners = ['exam', 'quiz']; $belongsTo = $owners[array_rand($owners)]; return [ 'course_id' => 1, 'exam_id' => $belongsTo === 'exam' ? ExamRepository::getAll()->random()->id : null, 'quiz_id' => $belongsTo === 'quiz' ? QuizRepository::getAll()->random()->id : null, 'question_text' => fake()->sentence(), 'question_type' => $questionType->value, 'options' => json_encode($options), ]; } }
/home/users/unlimited/www/learnoid.codeskitter.site/database/factories/QuestionFactory.php