1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace Database\Seeders\Agent;
- 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 AgentSeeder extends BaseSeeder
- {
- public function getColumnData()
- {
- return [
- 'username' => ['type' => 'string_60', 'title' => '账号名称'],
- 'real_username' => ['type' => 'string_60', 'title' => '真实姓名'],
- 'avatar' => ['type' => 'string_60', 'title' => '头像', 'is_null' => 1],
- 'roles' => ['type' => 'json', 'title' => '角色', 'is_null' => 1],
- 'remember_token' => ['type' => 'varchar_100', 'title' => '记住用户', 'is_null' => 1],
- 'status' => ['type' => 'string_60', 'title' => '状态', 'remark' => '1 启用 2 禁用'],
- 'profit_account' => ['type' => 'string', 'title' => '分账接收方帐号'],
- 'profit_name' => ['type' => 'string', 'title' => '分账接收方全称'],
- 'profit_relation_type' => ['type' => 'string', 'title' => '与分账方的关系类型'],
- 'profit_custom_relation' => ['type' => 'json', 'title' => '自定义的分账关系'],
- 'profit_ratio' => ['type' => 'decimal', 'length' => 8, 'decimal' => 2, 'title' => '接收方分账比例'],
- '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]),
- 'status' => 1,
- 'remark' => '',
- ]);
- }
- /**
- * Run the database seeds.
- *
- * @return void
- */
- public function run()
- {
- $this->schema = 'agent';
- $this->title = '代理商用户主表';
- $this->start();
- }
- }
|