コード例 #1
0
 protected function seeds_model_QuizModel()
 {
     \DB::table(QuizStepModel::getTableName())->delete();
     $quiz = QuizModel::create(array('title' => '产品满意度调研', 'desc' => $this->fake_html5(), 'type' => '调研'));
     for ($i = 0; $i < 5; $i++) {
         $step = $quiz->addStep(array('text' => $this->faker->sentence, 'type' => QuizStepModel::Type_SingleSelect));
         foreach (['A', 'B', 'C', 'D'] as $j) {
             $step->addOption($j, $this->faker->sentence);
         }
     }
     $quiz = QuizModel::create(array('title' => '课程满意度调研', 'desc' => $this->fake_html5(), 'type' => '调研'));
     for ($i = 0; $i < 5; $i++) {
         $step = $quiz->addStep(array('text' => $this->faker->sentence, 'type' => QuizStepModel::Type_SingleSelect));
         foreach (['A', 'B', 'C', 'D'] as $j) {
             $step->addOption($j, $this->faker->sentence);
         }
     }
     $quiz = QuizModel::create(array('title' => '成都MBA市场调研', 'desc' => $this->fake_html5(), 'type' => '调研'));
     for ($i = 0; $i < 5; $i++) {
         $step = $quiz->addStep(array('text' => $this->faker->sentence, 'type' => QuizStepModel::Type_SingleSelect));
         foreach (['A', 'B', 'C', 'D'] as $j) {
             $step->addOption($j, $this->faker->sentence);
         }
     }
     $quiz = QuizModel::create(array('title' => 'xxxx市场调研', 'desc' => $this->fake_html5(), 'type' => '调研'));
     for ($i = 0; $i < 5; $i++) {
         $step = $quiz->addStep(array('text' => $this->faker->sentence, 'type' => QuizStepModel::Type_SingleSelect));
         foreach (['A', 'B', 'C', 'D'] as $j) {
             $step->addOption($j, $this->faker->sentence);
         }
     }
     return null;
 }