mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Simplify factory state
This commit is contained in:
parent
eefe377159
commit
ab561d1ce8
|
@ -355,7 +355,9 @@ class AssetFactory extends Factory
|
|||
|
||||
public function hasEncryptedCustomField()
|
||||
{
|
||||
return $this->state(['model_id' => AssetModel::where('name', 'asset with encrypted field')->first() ?? AssetModel::factory()->withEncryptedField()]);
|
||||
return $this->afterMaking(function (Asset $asset) {
|
||||
$asset->model_id = AssetModel::factory()->withEncryptedField()->create()->id;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue