您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

DatabaseSeeder.php 974B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace Database\Seeders;
  3. use App\Models\User;
  4. use Illuminate\Database\Seeder;
  5. class DatabaseSeeder extends Seeder
  6. {
  7. /**
  8. * Seed the application's database.
  9. */
  10. public function run(): void
  11. {
  12. // Create a single admin user and their personal company
  13. $adminUser = User::factory()
  14. ->withPersonalCompany() // Ensures the user has a personal company created alongside
  15. ->create([
  16. 'name' => 'Admin',
  17. 'email' => 'admin@gmail.com',
  18. 'password' => bcrypt('password'),
  19. 'current_company_id' => 1, // Assuming this will be the ID of the created company
  20. 'created_at' => now(),
  21. ]);
  22. // Optionally, set additional properties or create related entities specific to this company
  23. $adminUser->ownedCompanies->first()->update([
  24. 'name' => 'ERPSAAS',
  25. 'created_at' => now(),
  26. ]);
  27. }
  28. }