NewsCategorySeeder.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace Database\Seeders\Backend;
  3. use Database\Seeders\BaseSeeder;
  4. use Illuminate\Support\Facades\DB;
  5. use Illuminate\Support\Str;
  6. /**
  7. * 新闻分类
  8. *
  9. * Class BusinessSeeder
  10. * @package Database\Seeders
  11. */
  12. class NewsCategorySeeder extends BaseSeeder
  13. {
  14. public function getColumnData()
  15. {
  16. return [
  17. 'product_id' => ['type' => 'uBigint', 'title' => '商品id', 'is_null' => false],
  18. 'name' => ['type' => 'string', 'title' => '名称'],
  19. 'remark' => ['type' => 'mediumtext', 'title' => '备注']
  20. ];
  21. }
  22. public function init()
  23. {
  24. DB::table($this->schema)->insert([
  25. 'product_id' => 1,
  26. 'mid' => Str::random(12),
  27. 'name' => "默认分类",
  28. 'remark' => '系统默认',
  29. 'created_at' => time(),
  30. 'updated_at' => time()
  31. ]);
  32. }
  33. /**
  34. * Run the database seeds.
  35. *
  36. * @return void
  37. */
  38. public function run()
  39. {
  40. $this->schema = 'news_category';
  41. $this->title = '新闻分类';
  42. // $this->category_type = 2;
  43. $this->start();
  44. }
  45. }