Use factories for relationships in asset factory

This commit is contained in:
Marcus Moore 2023-02-07 16:17:05 -08:00
parent 6dbcec2310
commit 3fdf4dea1b
No known key found for this signature in database

View file

@ -38,7 +38,7 @@ class AssetFactory extends Factory
{ {
return [ return [
'name' => null, 'name' => null,
'rtd_location_id' => Location::all()->random()->id, 'rtd_location_id' => Location::factory(),
'serial' => $this->faker->uuid, 'serial' => $this->faker->uuid,
'status_id' => 1, 'status_id' => 1,
'user_id' => 1, 'user_id' => 1,
@ -47,7 +47,7 @@ class AssetFactory extends Factory
'purchase_date' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get()), 'purchase_date' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get()),
'purchase_cost' => $this->faker->randomFloat(2, '299.99', '2999.99'), 'purchase_cost' => $this->faker->randomFloat(2, '299.99', '2999.99'),
'order_number' => $this->faker->numberBetween(1000000, 50000000), 'order_number' => $this->faker->numberBetween(1000000, 50000000),
'supplier_id' => Supplier::all()->random()->id, 'supplier_id' => Supplier::factory(),
'requestable' => $this->faker->boolean(), 'requestable' => $this->faker->boolean(),
'assigned_to' => null, 'assigned_to' => null,
'assigned_type' => null, 'assigned_type' => null,