From d648e9a01c96ad32ad47923689cf20a011712fcf Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 10 May 2023 09:13:34 -0700 Subject: [PATCH] Added Google test user Signed-off-by: snipe --- database/factories/UserFactory.php | 14 ++++++++++++++ database/seeders/UserSeeder.php | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index f40301753b..8aa38d2325 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -65,6 +65,20 @@ class UserFactory extends Factory }); } + public function testAdmin() + { + return $this->state(function () { + return [ + 'first_name' => 'Alison', + 'last_name' => 'Gianotto', + 'username' => 'agianotto@grokability.com', + 'avatar' => '2.jpg', + 'email' => 'agianotto@grokability.com', + 'permissions' => '{"superuser":"1"}', + ]; + }); + } + public function superuser() { return $this->state(function () { diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php index 2eba6f3721..9c237b169e 100644 --- a/database/seeders/UserSeeder.php +++ b/database/seeders/UserSeeder.php @@ -47,6 +47,13 @@ class UserSeeder extends Seeder ])) ->create(); + User::factory()->count(1)->testAdmin() + ->state(new Sequence(fn($sequence) => [ + 'company_id' => $companyIds->random(), + 'department_id' => $departmentIds->random(), + ])) + ->create(); + User::factory()->count(3)->superuser() ->state(new Sequence(fn($sequence) => [ 'company_id' => $companyIds->random(),