|  | @@ -2,6 +2,9 @@
 | 
		
	
		
			
			| 2 | 2 |  
 | 
		
	
		
			
			| 3 | 3 |  namespace Database\Seeders;
 | 
		
	
		
			
			| 4 | 4 |  
 | 
		
	
		
			
			|  | 5 | +use App\Models\Company;
 | 
		
	
		
			
			|  | 6 | +use App\Models\User;
 | 
		
	
		
			
			|  | 7 | +use Database\Factories\CompanyFactory;
 | 
		
	
		
			
			| 5 | 8 |  use Illuminate\Database\Seeder;
 | 
		
	
		
			
			| 6 | 9 |  
 | 
		
	
		
			
			| 7 | 10 |  class DatabaseSeeder extends Seeder
 | 
		
	
	
		
			
			|  | @@ -11,8 +14,58 @@ class DatabaseSeeder extends Seeder
 | 
		
	
		
			
			| 11 | 14 |       */
 | 
		
	
		
			
			| 12 | 15 |      public function run(): void
 | 
		
	
		
			
			| 13 | 16 |      {
 | 
		
	
		
			
			| 14 |  | -        $this->call([
 | 
		
	
		
			
			| 15 |  | -            UserCompanySeeder::class,
 | 
		
	
		
			
			| 16 |  | -        ]);
 | 
		
	
		
			
			|  | 17 | +        // Create a single admin user and their personal company
 | 
		
	
		
			
			|  | 18 | +        $user = User::factory()
 | 
		
	
		
			
			|  | 19 | +            ->withPersonalCompany(function (CompanyFactory $factory) {
 | 
		
	
		
			
			|  | 20 | +                return $factory
 | 
		
	
		
			
			|  | 21 | +                    ->state([
 | 
		
	
		
			
			|  | 22 | +                        'name' => 'ERPSAAS',
 | 
		
	
		
			
			|  | 23 | +                    ])
 | 
		
	
		
			
			|  | 24 | +                    ->withTransactions(250)
 | 
		
	
		
			
			|  | 25 | +                    ->withOfferings()
 | 
		
	
		
			
			|  | 26 | +                    ->withClients()
 | 
		
	
		
			
			|  | 27 | +                    ->withVendors()
 | 
		
	
		
			
			|  | 28 | +                    ->withInvoices(30)
 | 
		
	
		
			
			|  | 29 | +                    ->withRecurringInvoices()
 | 
		
	
		
			
			|  | 30 | +                    ->withEstimates(30)
 | 
		
	
		
			
			|  | 31 | +                    ->withBills(30);
 | 
		
	
		
			
			|  | 32 | +            })
 | 
		
	
		
			
			|  | 33 | +            ->create([
 | 
		
	
		
			
			|  | 34 | +                'name' => 'Admin',
 | 
		
	
		
			
			|  | 35 | +                'email' => 'admin@erpsaas.com',
 | 
		
	
		
			
			|  | 36 | +                'password' => bcrypt('password'),
 | 
		
	
		
			
			|  | 37 | +                'current_company_id' => 1,  // Assuming this will be the ID of the created company
 | 
		
	
		
			
			|  | 38 | +            ]);
 | 
		
	
		
			
			|  | 39 | +
 | 
		
	
		
			
			|  | 40 | +        // Only use en locale for now
 | 
		
	
		
			
			|  | 41 | +        $additionalCompanies = [
 | 
		
	
		
			
			|  | 42 | +            ['name' => 'British Crown Analytics', 'country' => 'GB', 'currency' => 'GBP', 'locale' => 'en'],
 | 
		
	
		
			
			|  | 43 | +            ['name' => 'Swiss Precision Group', 'country' => 'CH', 'currency' => 'CHF', 'locale' => 'en'],
 | 
		
	
		
			
			|  | 44 | +            ['name' => 'Tokyo Future Technologies', 'country' => 'JP', 'currency' => 'JPY', 'locale' => 'en'],
 | 
		
	
		
			
			|  | 45 | +            ['name' => 'Sydney Harbor Systems', 'country' => 'AU', 'currency' => 'AUD', 'locale' => 'en'],
 | 
		
	
		
			
			|  | 46 | +            ['name' => 'Mumbai Software Services', 'country' => 'IN', 'currency' => 'INR', 'locale' => 'en'],
 | 
		
	
		
			
			|  | 47 | +            ['name' => 'Singapore Digital Hub', 'country' => 'SG', 'currency' => 'SGD', 'locale' => 'en'],
 | 
		
	
		
			
			|  | 48 | +            ['name' => 'Dubai Business Consulting', 'country' => 'AE', 'currency' => 'AED', 'locale' => 'en'],
 | 
		
	
		
			
			|  | 49 | +        ];
 | 
		
	
		
			
			|  | 50 | +
 | 
		
	
		
			
			|  | 51 | +        foreach ($additionalCompanies as $companyData) {
 | 
		
	
		
			
			|  | 52 | +            Company::factory()
 | 
		
	
		
			
			|  | 53 | +                ->state([
 | 
		
	
		
			
			|  | 54 | +                    'name' => $companyData['name'],
 | 
		
	
		
			
			|  | 55 | +                    'user_id' => $user->id,
 | 
		
	
		
			
			|  | 56 | +                    'personal_company' => false,
 | 
		
	
		
			
			|  | 57 | +                ])
 | 
		
	
		
			
			|  | 58 | +                ->withCompanyProfile($companyData['country'])
 | 
		
	
		
			
			|  | 59 | +                ->withCompanyDefaults($companyData['currency'], $companyData['locale'])
 | 
		
	
		
			
			|  | 60 | +                ->withTransactions(100)
 | 
		
	
		
			
			|  | 61 | +                ->withOfferings()
 | 
		
	
		
			
			|  | 62 | +                ->withClients()
 | 
		
	
		
			
			|  | 63 | +                ->withVendors()
 | 
		
	
		
			
			|  | 64 | +                ->withInvoices(15)
 | 
		
	
		
			
			|  | 65 | +                ->withRecurringInvoices()
 | 
		
	
		
			
			|  | 66 | +                ->withEstimates(15)
 | 
		
	
		
			
			|  | 67 | +                ->withBills(15)
 | 
		
	
		
			
			|  | 68 | +                ->create();
 | 
		
	
		
			
			|  | 69 | +        }
 | 
		
	
		
			
			| 17 | 70 |      }
 | 
		
	
		
			
			| 18 | 71 |  }
 |