Skip to content

Conversation

@solidarity-forever
Copy link

Improved update Method with Flexible WHERE Conditions

The original update method only supported an array-based WHERE condition, which limited flexibility when handling more complex conditions (e.g., using OR, nested conditions, or raw SQL expressions). To address this limitation, I have modified the method to support custom WHERE clauses.

I have implemented two versions of the updated method, allowing you to choose the one that best fit for this project.

  1. Modify the original function
update('users', ['name' => 'John'], 'id = ? OR email = ?', [10, 'test@example.com']);
  1. Add a new function
updateByWhere('users', ['name' => 'John'], 'id = ? OR email = ?', [10, 'test@example.com']);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant