mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
immutable when things are looping, just in case
This commit is contained in:
parent
3fb62874f0
commit
b73f20cadf
|
@ -9,6 +9,7 @@ use App\Models\Statuslabel;
|
|||
use App\Models\Supplier;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class AssetFactory extends Factory
|
||||
|
@ -57,10 +58,10 @@ class AssetFactory extends Factory
|
|||
// calculates the EOL date most of the time, but sometimes sets a random date so we have some explicits
|
||||
// the explicit boolean gets set in the saving() method on the observer
|
||||
$asset->asset_eol_date = $this->faker->boolean(5)
|
||||
? Carbon::parse($asset->purchase_date)->addMonths(rand(0, 20))->format('Y-m-d')
|
||||
: Carbon::parse($asset->purchase_date)->addMonths($asset->model->eol)->format('Y-m-d');
|
||||
? CarbonImmutable::parse($asset->purchase_date)->addMonths(rand(0, 20))->format('Y-m-d')
|
||||
: CarbonImmutable::parse($asset->purchase_date)->addMonths($asset->model->eol)->format('Y-m-d');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function laptopMbp()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue