mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Add properties necessary for factories to be called in isolation
This commit is contained in:
parent
d9c1a548f1
commit
605f214597
|
@ -35,11 +35,18 @@ class AccessoryFactory extends Factory
|
|||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => sprintf(
|
||||
'%s %s',
|
||||
$this->faker->randomElement(['Bluetooth', 'Wired']),
|
||||
$this->faker->randomElement(['Keyboard', 'Wired'])
|
||||
),
|
||||
'user_id' => function () {
|
||||
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
|
||||
},
|
||||
'category_id' => Category::factory(),
|
||||
'model_number' => $this->faker->numberBetween(1000000, 50000000),
|
||||
'location_id' => Location::factory(),
|
||||
'qty' => 1,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ class AssetFactory extends Factory
|
|||
{
|
||||
return [
|
||||
'name' => null,
|
||||
'model_id' => AssetModel::factory(),
|
||||
'rtd_location_id' => Location::factory(),
|
||||
'serial' => $this->faker->uuid(),
|
||||
'status_id' => function () {
|
||||
|
|
|
@ -91,6 +91,7 @@ class AssetModelFactory extends Factory
|
|||
return User::first() ?? User::factory()->firstAdmin();
|
||||
},
|
||||
'name' => $this->faker->catchPhrase(),
|
||||
'category_id' => Category::factory(),
|
||||
'model_number' => $this->faker->creditCardNumber(),
|
||||
'notes' => 'Created by demo seeder',
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ class CategoryFactory extends Factory
|
|||
{
|
||||
return [
|
||||
'name' => $this->faker->catchPhrase(),
|
||||
'category_type' => 'asset',
|
||||
'checkin_email' => $this->faker->boolean(),
|
||||
'eula_text' => $this->faker->paragraph(),
|
||||
'require_acceptance' => false,
|
||||
|
|
|
@ -34,6 +34,8 @@ class ConsumableFactory extends Factory
|
|||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->word(),
|
||||
'category_id' => Category::factory(),
|
||||
'user_id' => function () {
|
||||
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
|
||||
},
|
||||
|
|
|
@ -32,6 +32,7 @@ class DepartmentFactory extends Factory
|
|||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->word() . ' Department',
|
||||
'user_id' => function () {
|
||||
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
|
||||
},
|
||||
|
|
|
@ -57,6 +57,7 @@ class LicenseFactory extends Factory
|
|||
'reassignable' => $this->faker->boolean(),
|
||||
'termination_date' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get())->format('Y-m-d H:i:s'),
|
||||
'supplier_id' => Supplier::factory(),
|
||||
'category_id' => Category::factory(),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ class ManufacturerFactory extends Factory
|
|||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->company(),
|
||||
'user_id' => function () {
|
||||
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue