From 625089acd183a35268a6f7dfeb5ef89a447101fb Mon Sep 17 00:00:00 2001 From: Kavalar Date: Mon, 16 Dec 2024 13:14:28 +0300 Subject: [PATCH] rest controller --- kernel/RestController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/RestController.php b/kernel/RestController.php index 0da92ff..2d7596d 100644 --- a/kernel/RestController.php +++ b/kernel/RestController.php @@ -94,7 +94,9 @@ class RestController $model = $this->model->where('id', $id)->first(); foreach ($model->getFillable() as $item){ - $model->{$item} = $data[$item] ?? null; + if (!empty($data[$item])){ + $model->{$item} = $data[$item] ?? null; + } } $model->save();