A free open source IT asset/license management system
Fixed #8794 - Switched to firstOrCreate to create parents on import
snipec0d7564658d6
diff --git a/app/Console/Commands/ImportLocations.php b/app/Console/Commands/ImportLocations.phpindex f36a384c1f..a0512aa393 100644--- a/app/Console/Commands/ImportLocations.php+++ b/app/Console/Commands/ImportLocations.php@@ -88,11 +88,13 @@ class ImportLocations extends Commandif (array_key_exists('Parent Name', $row)) {$parent_name = trim($row['Parent Name']);+ } else {+ $parent_name = null;}// Set the location attributes to saveif (array_key_exists('Name', $row)) {- $location = Location::firstOrNew(array('name' => trim($row['Name'])));+ $location = Location::firstOrCreate(array('name' => trim($row['Name'])));$location->name = trim($row['Name']);$this->info('Checking location: '.$location->name);} else {