示例#1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // $this->call(UserTableSeeder::class);
     App\Quiz::create(['user_id' => 1, 'name' => 'The awesome quiz', 'desc' => 'Get ready to embark on the best quiz, OF YOUR LIFE!']);
     App\Question::create(['quiz_id' => 1, 'question_type_id' => 1, 'title' => 'Who wrote this wonderful Quiz?', 'time_limit' => 10000]);
     App\Answer::create(['question_id' => 1, 'answer_type_id' => 1, 'text' => 'Shane', 'value' => 1, 'correct' => true]);
     App\Answer::create(['question_id' => 1, 'answer_type_id' => 1, 'text' => 'Bob', 'value' => 1, 'correct' => false]);
     App\Answer::create(['question_id' => 1, 'answer_type_id' => 1, 'text' => 'Jordan', 'value' => 1, 'correct' => true]);
     App\Answer::create(['question_id' => 1, 'answer_type_id' => 1, 'text' => 'Uncle Sam', 'value' => 1, 'correct' => false]);
     Model::reguard();
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('questions', function (Blueprint $table) {
         $table->increments('id');
         $table->string('question');
         $table->integer('likes');
         $table->timestamps();
     });
     Schema::table('questions', function (Blueprint $table) {
         $table->integer('job_id')->unsigned()->index();
         $table->integer('state_id')->unsigned()->index();
         $table->integer('user_id')->unsigned()->index();
     });
     App\Question::create(['question' => 'Je suis un homme ?', 'likes' => 5, 'job_id' => 1, 'user_id' => 1, 'state_id' => 1]);
 }
示例#3
0
 public function run()
 {
     DB::table('questions')->truncate();
     // id: 1
     App\Question::create(['description' => '2 x 2 = ?', 'topic_id' => 1]);
     // id: 2
     App\Question::create(['description' => 'Who is the founder of Facebook?', 'topic_id' => 3]);
     // id: 3
     App\Question::create(['description' => '3 x 3 = ?', 'topic_id' => 1]);
     // id: 4
     App\Question::create(['description' => '4 x 6 = ?', 'topic_id' => 1]);
     // id: 5
     App\Question::create(['description' => 'Who is NOT a Beatles team member?', 'topic_id' => 2]);
     // id: 6
     App\Question::create(['description' => 'Specify the song that was created by Nirvana?', 'topic_id' => 2]);
     // id: 7
     App\Question::create(['description' => 'Who is the founder of Groupon?', 'topic_id' => 3]);
 }