1234567891011121314151617181920212223242526272829303132333435 |
- <?php
-
- namespace Database\Seeders;
-
- use App\Models\User;
- use Database\Factories\CompanyFactory;
- use Illuminate\Database\Seeder;
-
- class DatabaseSeeder extends Seeder
- {
- /**
- * Seed the application's database.
- */
- public function run(): void
- {
- // Create a single admin user and their personal company
- $adminUser = User::factory()
- ->withPersonalCompany(function (CompanyFactory $factory) {
- return $factory->withTransactions();
- })
- ->create([
- 'name' => 'Admin',
- 'email' => 'admin@gmail.com',
- 'password' => bcrypt('password'),
- 'current_company_id' => 1, // Assuming this will be the ID of the created company
- 'created_at' => now(),
- ]);
-
- // Optionally, set additional properties or create related entities specific to this company
- $adminUser->ownedCompanies->first()->update([
- 'name' => 'ERPSAAS',
- 'created_at' => now(),
- ]);
- }
- }
|