-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Closed
Description
Laravel Version
9.52.15
PHP Version
8.1.19
Database Driver & Version
MySQL 8.0.33 for macOS 13.4.1 on arm64 (Homebrew)
Description
incrementEach() and decrementEach() dont respect where condition when used for eloquent model.
$user = User::where('shop_id', 1)->first();
$user->decrementEach(['counter' => 1, 'balance' => 100]);
All users in the table are decremented whatever 'shop_id' they have.
Please note that the problem is only if executed via eloquent model , but works correctly if executed via direct query as below
User::where('shop_id', 1)->decrementEach(['counter' => 1, 'balance' => 100]); // works correctly
Steps To Reproduce
incrementEach() and decrementEach() dont respect where condition when used for eloquent model.
$user = User::where('shop_id', 1)->first();
$user->decrementEach(['counter' => 1, 'balance' => 100]);
All users in the table are decremented whatever 'shop_id' they have.
Please note that the problem is only if executed via eloquent model , but works correctly if executed via direct query as below
User::where('shop_id', 1)->decrementEach(['counter' => 1, 'balance' => 100]); // works correctly
Metadata
Metadata
Assignees
Labels
No labels