2024-05-21 12:29:06 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Database\Seeders;
|
|
|
|
|
|
|
|
use App\Models\Team;
|
|
|
|
use App\Models\User;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
|
|
|
|
|
|
class TestTeamSeeder extends Seeder
|
|
|
|
{
|
|
|
|
public function run(): void
|
|
|
|
{
|
|
|
|
// User has 2 teams, 1 personal, 1 other where it is the owner and no other members are in the team
|
|
|
|
$user = User::factory()->create([
|
|
|
|
'name' => '1 personal, 1 other team, owner, no other members',
|
|
|
|
'email' => '1@example.com',
|
|
|
|
]);
|
|
|
|
$team = Team::create([
|
2024-06-10 20:43:34 +00:00
|
|
|
'name' => '1@example.com',
|
2024-05-21 12:29:06 +00:00
|
|
|
'personal_team' => false,
|
2024-06-10 20:43:34 +00:00
|
|
|
'show_boarding' => true,
|
2024-05-21 12:29:06 +00:00
|
|
|
]);
|
|
|
|
$user->teams()->attach($team, ['role' => 'owner']);
|
|
|
|
|
|
|
|
// User has 2 teams, 1 personal, 1 other where it is the owner and 1 other member is in the team
|
|
|
|
$user = User::factory()->create([
|
|
|
|
'name' => 'owner: 1 personal, 1 other team, owner, 1 other member',
|
|
|
|
'email' => '2@example.com',
|
|
|
|
]);
|
|
|
|
$team = Team::create([
|
2024-06-10 20:43:34 +00:00
|
|
|
'name' => '2@example.com',
|
2024-05-21 12:29:06 +00:00
|
|
|
'personal_team' => false,
|
2024-06-10 20:43:34 +00:00
|
|
|
'show_boarding' => true,
|
2024-05-21 12:29:06 +00:00
|
|
|
]);
|
|
|
|
$user->teams()->attach($team, ['role' => 'owner']);
|
|
|
|
$user = User::factory()->create([
|
|
|
|
'name' => 'member: 1 personal, 1 other team, owner, 1 other member',
|
|
|
|
'email' => '3@example.com',
|
|
|
|
]);
|
|
|
|
$team->members()->attach($user, ['role' => 'member']);
|
|
|
|
}
|
|
|
|
}
|