NewsListSeeder.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 NewsListSeeder extends BaseSeeder
  13. {
  14. public function getColumnData()
  15. {
  16. return [
  17. 'product_id' => ['type' => 'uBigint', 'title' => '商品id', 'is_null' => false],
  18. 'category_id' => ['type' => 'uBigint', 'title' => '分类ID'],
  19. 'tag' => ['type' => 'string_20', 'title' => '英文标识,方便查询'],
  20. 'title' => ['type' => 'string', 'title' => '标题'],
  21. 'logo' => ['type' => 'string', 'title' => '封面图'],
  22. 'introduction' => ['type' => 'string', 'title' => '简介'],
  23. 'content' => ['type' => 'text', 'title' => '内容'],
  24. 'status' => ['type' => 'tinyint', 'title' => '状态', 'remark' => '1使用 2禁用']
  25. ];
  26. }
  27. public function init()
  28. {
  29. DB::table($this->schema)->insert([
  30. 'product_id' => 1,
  31. 'mid' => Str::random(12),
  32. 'category_id' => 1,
  33. 'tag' => "home",
  34. 'title' => '跳跳鱼科技',
  35. 'logo' => '',
  36. 'introduction' => '跳跳鱼科技',
  37. 'content' => '跳跳鱼科技',
  38. 'status' => 1,
  39. 'created_at' => time(),
  40. 'updated_at' => time()
  41. ]);
  42. }
  43. /**
  44. * Run the database seeds.
  45. *
  46. * @return void
  47. */
  48. public function run()
  49. {
  50. $this->schema = 'news';
  51. $this->title = '新闻列表';
  52. // $this->category_type = 2;
  53. $this->start();
  54. }
  55. }