CommentsTableSeeder.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. declare(strict_types=1);
  3. namespace Tests\Commands\Upgrade\Databases\V17_0_0\Seeds;
  4. use Illuminate\Database\Seeder;
  5. use Illuminate\Support\Facades\DB;
  6. class CommentsTableSeeder extends Seeder
  7. {
  8. /**
  9. * Run the database seeds.
  10. *
  11. * @return void
  12. */
  13. public function run()
  14. {
  15. if (DB::table('comments')->exists()) {
  16. $this->command->getOutput()->writeln('<question>Skipping: ' . __CLASS__ . '</question>');
  17. return;
  18. }
  19. DB::table('comments')->insert([
  20. [
  21. 'id' => 1,
  22. 'socialite_user_id' => 1,
  23. 'article_id' => 1,
  24. 'content' => '评论的内容',
  25. 'is_audited' => 1,
  26. '_lft' => 1,
  27. '_rgt' => 2,
  28. 'parent_id' => null,
  29. 'created_at' => '2017-7-16 07:35:12',
  30. 'updated_at' => '2016-7-16 07:35:12',
  31. 'deleted_at' => null,
  32. ],
  33. [
  34. 'id' => 2,
  35. 'socialite_user_id' => 1,
  36. 'article_id' => 1,
  37. 'content' => '已删除',
  38. 'is_audited' => 1,
  39. '_lft' => 3,
  40. '_rgt' => 4,
  41. 'parent_id' => null,
  42. 'created_at' => '2019-01-04 16:35:12',
  43. 'updated_at' => '2019-01-04 16:35:12',
  44. 'deleted_at' => '2019-01-04 16:35:12',
  45. ],
  46. ]);
  47. }
  48. }