Skip to content

Commit 152c89b

Browse files
miclausdriesvints
andauthored
Copy DatabaseSeeder when installing with team support (#1461)
* Copy DatabaseSeeder when installing with team support To ensureApplicationIsTeamCompatible, the seeded test user must be created withPersonalTeam. * Update DatabaseSeeder.php --------- Co-authored-by: Dries Vints <dries@vints.be>
1 parent a57f6e9 commit 152c89b

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

database/seeders/DatabaseSeeder.php

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Database\Seeders;
4+
5+
use App\Models\User;
6+
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
7+
use Illuminate\Database\Seeder;
8+
9+
class DatabaseSeeder extends Seeder
10+
{
11+
/**
12+
* Seed the application's database.
13+
*/
14+
public function run(): void
15+
{
16+
// User::factory(10)->withPersonalTeam()->create();
17+
18+
User::factory()->withPersonalTeam()->create([
19+
'name' => 'Test User',
20+
'email' => 'test@example.com',
21+
]);
22+
}
23+
}

src/Console/InstallCommand.php

+3
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,9 @@ protected function ensureApplicationIsTeamCompatible()
554554
// Factories...
555555
copy(__DIR__.'/../../database/factories/UserFactory.php', base_path('database/factories/UserFactory.php'));
556556
copy(__DIR__.'/../../database/factories/TeamFactory.php', base_path('database/factories/TeamFactory.php'));
557+
558+
// Seeders...
559+
copy(__DIR__.'/../../database/seeders/DatabaseSeeder.php', base_path('database/seeders/DatabaseSeeder.php'));
557560
}
558561

559562
/**

0 commit comments

Comments
 (0)