diff --git a/src/Repositories/BaseRepository.php b/src/Repositories/BaseRepository.php index 2ebdc85..b47e140 100644 --- a/src/Repositories/BaseRepository.php +++ b/src/Repositories/BaseRepository.php @@ -405,8 +405,7 @@ public function updateById(array $attributes, int $id) */ public function updateByWhere(array $condition, array $attributes) { - $this->applyConditions($condition); - $model = $this->model->firstOrFail(); + $model = $this->model->where($condition)->firstOrFail(); $model->fill($attributes); $model->save(); $this->resetModel(); @@ -424,7 +423,7 @@ public function updateByWhere(array $condition, array $attributes) */ public function updateFieldById(int $id, string $filedName, string $fieldValue) { - $model = $this->model->find($id); + $model = $this->model->findOrFail($id); $model->$filedName = $fieldValue; $result = $model->save(); $this->resetModel();