領収証発行サービス
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.9KB

  1. <?php
  2. namespace Database\Seeders;
  3. use App\Codes\Custom;
  4. use App\Codes\SMSProviderName;
  5. use App\Codes\UserRole;
  6. use App\Models\Contract;
  7. use App\Models\SMSProvider;
  8. use App\Models\User;
  9. use Illuminate\Database\Console\Seeds\WithoutModelEvents;
  10. use Illuminate\Database\Seeder;
  11. class TestUserSeeder extends Seeder
  12. {
  13. /**
  14. * Run the database seeds.
  15. */
  16. public function run(): void
  17. {
  18. $contract = Contract::factory()->create([
  19. Contract::COL_NAME_NAME => 'テスト用契約'
  20. ]);
  21. $emails = [
  22. ['normal@aa.com', UserRole::NORMAL_ADMIN],
  23. ['contract@aa.com', UserRole::CONTRACT_ADMIN],
  24. ['admin@aa.com', UserRole::SUPER_ADMIN],
  25. ];
  26. foreach ($emails as [$email, $role]) {
  27. if (!User::whereEmail($email)->exists()) {
  28. User::factory()->for($contract)->create([
  29. User::COL_NAME_EMAIL => $email,
  30. User::COL_NAME_ROLE => $role,
  31. User::COL_NAME_NAME => $email . "太郎",
  32. ]);
  33. }
  34. }
  35. $contract = Contract::factory()->create([
  36. Contract::COL_NAME_NAME => 'テスト用契約 HT',
  37. Contract::COL_NAME_CUSTOM => Custom::HELLO_TECHNO,
  38. ]);
  39. $email = 'hello@aa.com';
  40. if (!User::whereEmail($email)->exists()) {
  41. User::factory()->for($contract)->create([
  42. User::COL_NAME_EMAIL => $email,
  43. User::COL_NAME_ROLE => UserRole::NORMAL_ADMIN,
  44. User::COL_NAME_NAME => $email . "太郎",
  45. ]);
  46. }
  47. $email = 'hello-admin@aa.com';
  48. if (!User::whereEmail($email)->exists()) {
  49. User::factory()->for($contract)->create([
  50. User::COL_NAME_EMAIL => $email,
  51. User::COL_NAME_ROLE => UserRole::CONTRACT_ADMIN,
  52. User::COL_NAME_NAME => $email . "太郎",
  53. ]);
  54. }
  55. }
  56. }