選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

DatabaseSeeder.php 885B

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