12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace Database\Seeders\Backend;
- use Database\Seeders\BaseSeeder;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Str;
- /**
- * 新闻列表
- *
- * Class BusinessSeeder
- * @package Database\Seeders
- */
- class NewsListSeeder extends BaseSeeder
- {
- public function getColumnData()
- {
- return [
- 'product_id' => ['type' => 'uBigint', 'title' => '商品id', 'is_null' => false],
- 'category_id' => ['type' => 'uBigint', 'title' => '分类ID'],
- 'tag' => ['type' => 'string_20', 'title' => '英文标识,方便查询'],
- 'title' => ['type' => 'string', 'title' => '标题'],
- 'logo' => ['type' => 'string', 'title' => '封面图'],
- 'introduction' => ['type' => 'string', 'title' => '简介'],
- 'content' => ['type' => 'text', 'title' => '内容'],
- 'status' => ['type' => 'tinyint', 'title' => '状态', 'remark' => '1使用 2禁用']
- ];
- }
- public function init()
- {
- DB::table($this->schema)->insert([
- 'product_id' => 1,
- 'mid' => Str::random(12),
- 'category_id' => 1,
- 'tag' => "home",
- 'title' => '跳跳鱼科技',
- 'logo' => '',
- 'introduction' => '跳跳鱼科技',
- 'content' => '跳跳鱼科技',
- 'status' => 1,
- 'created_at' => time(),
- 'updated_at' => time()
- ]);
- }
- /**
- * Run the database seeds.
- *
- * @return void
- */
- public function run()
- {
- $this->schema = 'news';
- $this->title = '新闻列表';
- // $this->category_type = 2;
- $this->start();
- }
- }
|