Updated factories

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-07-05 08:21:18 +01:00
parent 16d65631aa
commit 24ad74f136
2 changed files with 12 additions and 3 deletions

View file

@ -300,11 +300,11 @@ class AssetFactory extends Factory
});
}
public function assignedToLocation()
public function assignedToLocation(Location $location = null)
{
return $this->state(function () {
return $this->state(function () use ($location) {
return [
'assigned_to' => Location::factory(),
'assigned_to' => $location->id ?? Location::factory(),
'assigned_type' => Location::class,
];
});

View file

@ -25,4 +25,13 @@ class LocationFactory extends Factory
'image' => rand(1, 9).'.jpg',
];
}
public function deletedLocation()
{
return $this->state(function () {
return [
'deleted_at' => $this->faker->dateTime(),
];
});
}
}