From 408c4685cc963a2cdb61cea91a3af98b8fe4d870 Mon Sep 17 00:00:00 2001 From: Vildan Bina Date: Mon, 20 Mar 2023 12:57:51 +0100 Subject: [PATCH] fixing a bug on importing with exsiting keys by modifying the variable name --- src/Services/ImportService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Services/ImportService.php b/src/Services/ImportService.php index 0e93a06..1449451 100644 --- a/src/Services/ImportService.php +++ b/src/Services/ImportService.php @@ -80,11 +80,11 @@ public function run(): bool|string } if ($this->updateWhenExists) { - $item = filled($this->updateKeys) ? $this->updateKeys : (new $this->model)->getKeyName(); + $updateKeys = filled($this->updateKeys) ? $this->updateKeys : (new $this->model)->getKeyName(); $this->model::updateOrCreate( - Arr::only($item, $item), - Arr::except($item, $item), + Arr::only($item, $updateKeys), + Arr::except($item, $updateKeys), ); } else { $this->model::create($item);