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.

DatabaseSeeder.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. ->withOfferings()
  22. ->withClients()
  23. ->withVendors()
  24. ->withInvoices(50)
  25. ->withRecurringInvoices()
  26. ->withEstimates(50)
  27. ->withBills(50);
  28. })
  29. ->create([
  30. 'name' => 'Admin',
  31. 'email' => 'admin@erpsaas.com',
  32. 'password' => bcrypt('password'),
  33. 'current_company_id' => 1, // Assuming this will be the ID of the created company
  34. ]);
  35. }
  36. }