From e7daa7a9dbdcc097921fa353473b19fd89428949 Mon Sep 17 00:00:00 2001 From: Ollama Date: Wed, 15 Apr 2026 15:29:43 +0000 Subject: [PATCH] fix: Remove primary key from update payload - Unset item_id from data array before update - Cleaner approach to avoid including PK in update payload Address CodeRabbit review feedback --- app/Models/Item.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Models/Item.php b/app/Models/Item.php index 1246d83b2..c89cfcfe6 100644 --- a/app/Models/Item.php +++ b/app/Models/Item.php @@ -450,9 +450,13 @@ class Item extends Model // If id > 0 and record exists, update it if ($id > 0 && $this->exists($id, true)) { + // Remove primary key from data array for update + $updateData = $data; + unset($updateData[$primaryKey]); + $builder = $this->db->table('items'); $builder->where($primaryKey, $id); - return $builder->update($data); + return $builder->update($updateData); } // Insert new record