From 66aaafc4f200918a5bbdfdd9744e0a1820779b93 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 13 Nov 2024 17:08:20 +0000 Subject: [PATCH] Updated variable name Signed-off-by: snipe --- app/Importer/AssetModelImporter.php | 22 +++++++++---------- app/Livewire/Importer.php | 4 ++-- resources/views/livewire/importer.blade.php | 3 +-- .../Importing/Api/ImportAssetModelsTest.php | 3 +-- .../AssetModelsImportFileBuilder.php | 1 - 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/app/Importer/AssetModelImporter.php b/app/Importer/AssetModelImporter.php index 898e0c1523..b3cc8671d1 100644 --- a/app/Importer/AssetModelImporter.php +++ b/app/Importer/AssetModelImporter.php @@ -40,9 +40,9 @@ class AssetModelImporter extends ItemImporter { $editingAssetModel = false; - $assetmodel = AssetModel::where('name', '=', $this->findCsvMatch($row, 'name'))->first(); + $assetModel = AssetModel::where('name', '=', $this->findCsvMatch($row, 'name'))->first(); - if ($assetmodel) { + if ($assetModel) { if (! $this->updating) { $this->log('A matching Model '.$this->item['name'].' already exists'); return; @@ -52,7 +52,7 @@ class AssetModelImporter extends ItemImporter $editingAssetModel = true; } else { $this->log('No Matching Model, Create a new one'); - $assetmodel = new AssetModel(); + $assetModel = new AssetModel(); } // Pull the records from the CSV to determine their values @@ -97,20 +97,20 @@ class AssetModelImporter extends ItemImporter if ($editingAssetModel) { Log::debug('Updating existing model'); - $assetmodel->update($this->sanitizeItemForUpdating($assetmodel)); + $assetModel->update($this->sanitizeItemForUpdating($assetModel)); } else { Log::debug('Creating model'); - $assetmodel->fill($this->sanitizeItemForStoring($assetmodel)); + $assetModel->fill($this->sanitizeItemForStoring($assetModel)); } - if ($assetmodel->save()) { - $this->log('AssetModel '.$assetmodel->name.' created or updated from CSV import'); - return $assetmodel; + if ($assetModel->save()) { + $this->log('AssetModel '.$assetModel->name.' created or updated from CSV import'); + return $assetModel; } else { - $this->log($assetmodel->getErrors()->first()); - $this->addErrorToBag($assetmodel, $assetmodel->getErrors()->keys()[0], $assetmodel->getErrors()->first()); - return $assetmodel->getErrors(); + $this->log($assetModel->getErrors()->first()); + $this->addErrorToBag($assetModel, $assetModel->getErrors()->keys()[0], $assetModel->getErrors()->first()); + return $assetModel->getErrors(); } } diff --git a/app/Livewire/Importer.php b/app/Livewire/Importer.php index 1296dbd106..75b707b8ad 100644 --- a/app/Livewire/Importer.php +++ b/app/Livewire/Importer.php @@ -73,7 +73,7 @@ class Importer extends Component case 'asset': $results = $this->assets_fields; break; - case 'assetmodel': + case 'assetModel': $results = $this->assetmodels_fields; break; case 'accessory': @@ -165,7 +165,7 @@ class Importer extends Component $this->importTypes = [ 'accessory' => trans('general.accessories'), 'asset' => trans('general.assets'), - 'assetmodel' => trans('general.asset_models'), + 'assetModel' => trans('general.asset_models'), 'component' => trans('general.components'), 'consumable' => trans('general.consumables'), 'license' => trans('general.licenses'), diff --git a/resources/views/livewire/importer.blade.php b/resources/views/livewire/importer.blade.php index 95d2a8bb91..7ce1f6485e 100644 --- a/resources/views/livewire/importer.blade.php +++ b/resources/views/livewire/importer.blade.php @@ -179,7 +179,7 @@ - @if (($typeOfImport != 'location' && $typeOfImport!= 'assetmodel') && ($typeOfImport!='')) + @if (($typeOfImport != 'location' && $typeOfImport!= 'assetModel') && ($typeOfImport!=''))