2023-03-24 13:54:17 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Database\Seeders;
|
|
|
|
|
|
|
|
use App\Models\Team;
|
|
|
|
use App\Models\User;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
|
|
|
|
|
|
class TeamSeeder extends Seeder
|
|
|
|
{
|
|
|
|
public function run(): void
|
|
|
|
{
|
2023-06-09 13:55:21 +00:00
|
|
|
$normal_user_in_root_team = User::find(1);
|
|
|
|
$root_user_personal_team = Team::find(0);
|
2023-06-16 13:01:58 +00:00
|
|
|
$root_user_personal_team->description = 'The root team';
|
|
|
|
$root_user_personal_team->save();
|
2023-03-24 13:54:17 +00:00
|
|
|
|
2023-06-09 13:55:21 +00:00
|
|
|
$normal_user_in_root_team->teams()->attach($root_user_personal_team);
|
|
|
|
|
|
|
|
$normal_user_not_in_root_team = User::find(2);
|
|
|
|
$normal_user_in_root_team_personal_team = Team::find(1);
|
|
|
|
$normal_user_not_in_root_team->teams()->attach($normal_user_in_root_team_personal_team, ['role' => 'admin']);
|
2023-03-24 13:54:17 +00:00
|
|
|
}
|
|
|
|
}
|