Skip to content

Commit dd84db6

Browse files
authored
Updated README.md
Added increment / decrement example
1 parent 70267a5 commit dd84db6

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,39 @@ $index = 'id';
7474
Batch::update($userInstance, $value, $index);
7575
```
7676

77+
# Example Increment / Decrement
78+
79+
```php
80+
use App\Models\User;
81+
82+
$userInstance = new User;
83+
$value = [
84+
[
85+
'id' => 1,
86+
'balance' => '+500' // Add
87+
] ,
88+
[
89+
'id' => 2,
90+
'balance' => '-200' // Subtract
91+
] ,
92+
[
93+
'id' => 3,
94+
'balance' => '*5' // Multiply
95+
] ,
96+
[
97+
'id' => 4,
98+
'balance' => '/2' // Divide
99+
] ,
100+
[
101+
'id' => 5,
102+
'balance' => '%2' // Modulo
103+
] ,
104+
];
105+
$index = 'id';
106+
107+
Batch::update($userInstance, $value, $index);
108+
```
109+
77110
# Example Insert
78111

79112
```php

0 commit comments

Comments
 (0)