UserAccountSeeder.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace Database\Seeders\Frontend;
  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. class UserAccountSeeder extends BaseSeeder
  10. {
  11. public function getColumnData()
  12. {
  13. return [
  14. 'user_id' => ['type' => 'uBigInt', 'title' => '用户id'],
  15. 'username' => ['type' => 'string_60', 'title' => '用户名'],
  16. 'mobile' => ['type' => 'string_60', 'title' => '手机号'],
  17. 'email' => ['type' => 'string_60', 'title' => '邮箱', 'is_null' => 1],
  18. 'password' => ['type' => 'string_60', 'title' => '密码'],
  19. 'retries' => ['type' => 'tinyInt', 'default' => 0, 'title' => '失败重试次数'],
  20. ];
  21. }
  22. /**
  23. * 初始化内容
  24. */
  25. public function init()
  26. {
  27. DB::table($this->schema)->insert([
  28. 'mid' => Str::random(12),
  29. 'created_at' => time(),
  30. 'updated_at' => time(),
  31. 'user_id' => 1,
  32. 'username' => 'tty',
  33. 'mobile' => '18260175830',
  34. 'email' => '597196313@qq.com',
  35. 'password' => Hash::make('asdfg1asdfg'),
  36. 'retries' => 1,
  37. ]);
  38. }
  39. /**
  40. * Run the database seeds.
  41. *
  42. * @return void
  43. */
  44. public function run()
  45. {
  46. $this->schema = 'user_account';
  47. $this->title = '用户表账号密码登录';
  48. $this->start();
  49. }
  50. }