PositionListSeeder.php 1.8 KB

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