From a2860f029cf79978d8aae345f36fefead1ae7eb4 Mon Sep 17 00:00:00 2001 From: Spitfire Date: Thu, 4 Jan 2024 16:49:59 -0600 Subject: [PATCH] Implemented requested changes --- app/Services/BulkService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Services/BulkService.php b/app/Services/BulkService.php index 0ea28226fa..bc4bf4615e 100644 --- a/app/Services/BulkService.php +++ b/app/Services/BulkService.php @@ -294,7 +294,7 @@ public function editing(array $fields, Bulk $bulk): int return $this->updateRelations($filledFields, $mirrorOptions); } - $parent = Str::singular($model->getTable()) . '_id'; + $parent = method_exists($model, 'getParentKeyName') ? $model->getParentKeyName() : null; // Todo: move model fetch above to actually use with() foreach ($this->ids as $id) { @@ -308,7 +308,7 @@ public function editing(array $fields, Bulk $bulk): int } $entityFields = $filledFields; - if(isset($entityFields[$parent]) && $entityFields[$parent] == strval($entity->id)) { + if(isset($entityFields[$parent]) && intval($entityFields[$parent]) == $entity->id) { unset($entityFields[$parent]); }