AgentSeeder.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace Database\Seeders\Agent;
  3. use Database\Seeders\BaseSeeder;
  4. use Illuminate\Support\Facades\DB;
  5. use Illuminate\Support\Facades\Hash;
  6. use Illuminate\Support\Str;
  7. use Txj\Elastic\Facades\Eav;
  8. use Txj\Elastic\Facades\ES;
  9. /**
  10. * 代理商
  11. */
  12. class AgentSeeder extends BaseSeeder
  13. {
  14. public function getColumnData()
  15. {
  16. return [
  17. 'username' => ['type' => 'string_60', 'title' => '账号名称'],
  18. 'real_username' => ['type' => 'string_60', 'title' => '真实姓名'],
  19. 'avatar' => ['type' => 'string_60', 'title' => '头像', 'is_null' => 1],
  20. 'roles' => ['type' => 'json', 'title' => '角色', 'is_null' => 1],
  21. 'remember_token' => ['type' => 'varchar_100', 'title' => '记住用户', 'is_null' => 1],
  22. 'status' => ['type' => 'string_60', 'title' => '状态', 'remark' => '1 启用 2 禁用'],
  23. 'profit_account' => ['type' => 'string', 'title' => '分账接收方帐号'],
  24. 'profit_name' => ['type' => 'string', 'title' => '分账接收方全称'],
  25. 'profit_relation_type' => ['type' => 'string', 'title' => '与分账方的关系类型'],
  26. 'profit_custom_relation' => ['type' => 'json', 'title' => '自定义的分账关系'],
  27. 'profit_ratio' => ['type' => 'decimal', 'length' => 8, 'decimal' => 2, 'title' => '接收方分账比例'],
  28. 'remark' => ['type' => 'string', 'title' => '备注'],
  29. ];
  30. }
  31. /**
  32. * 初始化内容
  33. */
  34. public function init()
  35. {
  36. DB::table($this->schema)->insert([
  37. 'mid' => Str::random(12),
  38. 'created_at' => time(),
  39. 'updated_at' => time(),
  40. 'username' => 'tty',
  41. 'real_username' => '李磊',
  42. 'avatar' => '',
  43. 'roles' => json_encode([1, 2]),
  44. 'status' => 1,
  45. 'remark' => '',
  46. ]);
  47. }
  48. /**
  49. * Run the database seeds.
  50. *
  51. * @return void
  52. */
  53. public function run()
  54. {
  55. $this->schema = 'agent';
  56. $this->title = '代理商用户主表';
  57. $this->start();
  58. }
  59. }