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;
 }
 public function index($id)
 {
     $quiz = QuizModel::find($id);
     if (!$quiz) {
         $this->layout->content = View::make('laravel-quiz::errors.missing');
     } else {
         $this->layout->content = View::make('laravel-quiz::contents.index')->with('title', $quiz->title)->with('desc', $quiz->desc);
     }
 }
 public static function createByUserAndQuiz(\Eloquent $user, QuizModel $quiz)
 {
     return static::create(array('user_id' => $user->getKey(), 'quiz_id' => $quiz->getKey(), 'token' => time() . KRandom::getRandStr(8), 'result_text' => '', 'status' => '未开始'));
 }