Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdelrahmanBl committed Dec 11, 2023
1 parent 1790384 commit 10eca38
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,17 @@ Optionally you can pass the starting order number as the second argument.
MyModel::setNewOrder([3,1,2], 10);
```

You can set a new order without global scopes as the fourth argument.
You can set a new order with a closure as the fourth argument.

```php
/**
* the record for model id 3 will have order_column value 11
* the record for model id 1 will have order_column value 12
* the record for model id 2 will have order_column value 13
*/
$yourGlobalScopes = [new ActiveScope, new DefaultScope];
MyModel::setNewOrder([3,1,2], 10, null, $yourGlobalScopes);
MyModel::setNewOrder([3,1,2], 10, null, function($query) {
$query->withoutGlobalScope(new ActiveScope);
});
```


Expand Down

0 comments on commit 10eca38

Please sign in to comment.