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 7, 2023
1 parent 2117e30 commit f94821a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,19 @@ 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.

```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);
```


To sort using a column other than the primary key, use the `setNewOrderByCustomColumn`-method.

```php
Expand Down

0 comments on commit f94821a

Please sign in to comment.