Skip to content

Instantly share code, notes, and snippets.

@andidp
Created August 9, 2016 04:10
Show Gist options
  • Save andidp/a34118c71525c755120c9d553f087fa0 to your computer and use it in GitHub Desktop.
Save andidp/a34118c71525c755120c9d553f087fa0 to your computer and use it in GitHub Desktop.
Answer Table Seeder
<?php
use Illuminate\Database\Seeder;
class AnswersTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('answers')->delete();
$answers = [
['id' => 1, 'question_id' => 1, 'title' => 'Work hard', 'body' => 'Lorem ipsum dolor sit amet', 'created_at' => new DateTime, 'updated_at' => new DateTime ],
['id' => 2, 'question_id' => 1, 'title' => 'Work hard', 'body' => 'Lorem ipsum dolor sit amet', 'created_at' => new DateTime, 'updated_at' => new DateTime ],
['id' => 3, 'question_id' => 2, 'title' => 'Work hard', 'body' => 'Lorem ipsum dolor sit amet', 'created_at' => new DateTime, 'updated_at' => new DateTime ],
['id' => 4, 'question_id' => 2, 'title' => 'Work hard', 'body' => 'Lorem ipsum dolor sit amet', 'created_at' => new DateTime, 'updated_at' => new DateTime ],
['id' => 5, 'question_id' => 3, 'title' => 'Work hard', 'body' => 'Lorem ipsum dolor sit amet','created_at' => new DateTime, 'updated_at' => new DateTime ],
['id' => 6, 'question_id' => 3, 'title' => 'Work hard', 'body' => 'Lorem ipsum dolor sit amet','created_at' => new DateTime, 'updated_at' => new DateTime ],
['id' => 7, 'question_id' => 4, 'title' => 'Work hard', 'body' => 'Lorem ipsum dolor sit amet','created_at' => new DateTime, 'updated_at' => new DateTime ],
['id' => 8, 'question_id' => 4, 'title' => 'Work hard', 'body' => 'Lorem ipsum dolor sit amet','created_at' => new DateTime, 'updated_at' => new DateTime ],
['id' => 9, 'question_id' => 5, 'title' => 'Work hard', 'body' => 'Lorem ipsum dolor sit amet','created_at' => new DateTime, 'updated_at' => new DateTime ],
['id' => 10, 'question_id' => 5, 'title' => 'Work hard', 'body' => 'Lorem ipsum dolor sit amet','created_at' => new DateTime, 'updated_at' => new DateTime ],
];
DB::table('questions')->insert($answers);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment