1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace Database\Seeders\Frontend;
- use Database\Seeders\BaseSeeder;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Facades\Hash;
- use Illuminate\Support\Str;
- use Txj\Elastic\Facades\Eav;
- use Txj\Elastic\Facades\ES;
- class UserSeeder extends BaseSeeder
- {
- public function getColumnData()
- {
- return [
- 'username' => ['type' => 'string_60', 'title' => '账号名称'],
- 'real_username' => ['type' => 'string_60', 'title' => '真实姓名'],
- 'avatar' => ['type' => 'string', 'title' => '头像', 'is_null' => 1],
- 'roles' => ['type' => 'json', 'title' => '角色', 'is_null' => 1],
- 'unionid' => ['type' => 'string_60', 'title' => '微信unionid'],
- 'status' => ['type' => 'string_60', 'title' => '状态', 'remark' => '1 启用 2 禁用'],
- 'remark' => ['type' => 'string', 'title' => '备注'],
- ];
- }
- /**
- * 初始化内容
- */
- public function init()
- {
- DB::table($this->schema)->insert([
- 'mid' => Str::random(12),
- 'created_at' => time(),
- 'updated_at' => time(),
- 'username' => 'tty',
- 'real_username' => '李磊',
- 'avatar' => '',
- 'roles' => json_encode([1, 2]),
- 'unionid' => '',
- 'status' => 1,
- 'remark' => '',
- ]);
- }
- /**
- * Run the database seeds.
- *
- * @return void
- */
- public function run()
- {
- $this->schema = 'user';
- $this->title = '用户表';
- $this->start();
- }
- }
|