From b73f20cadfc28dfaf739908b677ed61e7903fa60 Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Wed, 16 Aug 2023 02:47:12 -0500 Subject: [PATCH] immutable when things are looping, just in case --- database/factories/AssetFactory.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/database/factories/AssetFactory.php b/database/factories/AssetFactory.php index a3170b22e8..644d292eb6 100644 --- a/database/factories/AssetFactory.php +++ b/database/factories/AssetFactory.php @@ -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() {