Skip to content

Commit 4c32db9

Browse files
committed
🔨 modify update() method
Signed-off-by: otengkwame <[email protected]>
1 parent e792c55 commit 4c32db9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Core/core/Models/EasyModel.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ public function upsert($idOrRow, $optionalValue = null, $data = [])
866866
*
867867
* @return boolean result
868868
*/
869-
public function update($idOrRow, $optionalValue = null, $data = [])
869+
public function update($idOrRow = null, $optionalValue = null, $data = [])
870870
{
871871
if ($optionalValue == null) {
872872
if (is_array($idOrRow)) {
@@ -878,6 +878,10 @@ public function update($idOrRow, $optionalValue = null, $data = [])
878878
$this->db->where([$idOrRow => $optionalValue]);
879879
}
880880

881+
if (is_null($idOrRow) && empty($data)) {
882+
return $this->db->update($this->table);
883+
}
884+
881885
return $this->db->update($this->table, $data);
882886
}
883887

0 commit comments

Comments
 (0)