From 90e75a3e2c3f3017dcb618ae45e7cca893c59304 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 19 Sep 2023 17:02:18 -0700 Subject: [PATCH] Add unique() to some factory properties --- database/factories/CompanyFactory.php | 2 +- database/factories/CustomFieldFactory.php | 2 +- database/factories/CustomFieldsetFactory.php | 2 +- database/factories/DepreciationFactory.php | 2 +- database/factories/ManufacturerFactory.php | 2 +- database/factories/UserFactory.php | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/database/factories/CompanyFactory.php b/database/factories/CompanyFactory.php index bf4b7ce242..607822fef1 100644 --- a/database/factories/CompanyFactory.php +++ b/database/factories/CompanyFactory.php @@ -22,7 +22,7 @@ class CompanyFactory extends Factory public function definition() { return [ - 'name' => $this->faker->company(), + 'name' => $this->faker->unique()->company(), ]; } } diff --git a/database/factories/CustomFieldFactory.php b/database/factories/CustomFieldFactory.php index adcca9cae1..2dfa07d61a 100644 --- a/database/factories/CustomFieldFactory.php +++ b/database/factories/CustomFieldFactory.php @@ -22,7 +22,7 @@ class CustomFieldFactory extends Factory public function definition() { return [ - 'name' => $this->faker->catchPhrase(), + 'name' => $this->faker->unique()->catchPhrase(), 'format' => '', 'element' => 'text', 'auto_add_to_fieldsets' => '0', diff --git a/database/factories/CustomFieldsetFactory.php b/database/factories/CustomFieldsetFactory.php index f369121c8f..e651b5c8d3 100644 --- a/database/factories/CustomFieldsetFactory.php +++ b/database/factories/CustomFieldsetFactory.php @@ -22,7 +22,7 @@ class CustomFieldsetFactory extends Factory public function definition() { return [ - 'name' => $this->faker->catchPhrase(), + 'name' => $this->faker->unique()->catchPhrase(), ]; } diff --git a/database/factories/DepreciationFactory.php b/database/factories/DepreciationFactory.php index 6a648d7ade..6359e2326b 100644 --- a/database/factories/DepreciationFactory.php +++ b/database/factories/DepreciationFactory.php @@ -23,7 +23,7 @@ class DepreciationFactory extends Factory public function definition() { return [ - 'name' => $this->faker->catchPhrase(), + 'name' => $this->faker->unique()->catchPhrase(), 'user_id' => User::factory()->superuser(), 'months' => 36, ]; diff --git a/database/factories/ManufacturerFactory.php b/database/factories/ManufacturerFactory.php index 4e736b8d8a..7d6892426d 100644 --- a/database/factories/ManufacturerFactory.php +++ b/database/factories/ManufacturerFactory.php @@ -23,7 +23,7 @@ class ManufacturerFactory extends Factory public function definition() { return [ - 'name' => $this->faker->company(), + 'name' => $this->faker->unique()->company(), 'user_id' => User::factory()->superuser(), 'support_phone' => $this->faker->phoneNumber(), 'url' => $this->faker->url(), diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 1416ec461f..c8fe69e0db 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -33,11 +33,11 @@ class UserFactory extends Factory 'permissions' => '{}', 'phone' => $this->faker->phoneNumber(), 'state' => $this->faker->stateAbbr(), - 'username' => $this->faker->username(), + 'username' => $this->faker->unique()->username(), 'zip' => $this->faker->postcode(), ]; } - + public function firstAdmin() { return $this->state(function () {