Skip to content

Commit

Permalink
[FEAT] add withoutGlobalScopes to setNewOrder method
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdelrahmanBl committed Nov 22, 2023
1 parent f6bf634 commit 027cf37
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/SortableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ public static function setNewOrder($ids, int $startOrder = 1, string $primaryKey

foreach ($ids as $id) {
static::withoutGlobalScope(SoftDeletingScope::class)
->when($withoutGlobalScopes, function($query, $withoutGlobalScopes) {
$query->withoutGlobalScopes($withoutGlobalScopes);
})
->withoutGlobalScopes($withoutGlobalScopes)
->where($primaryKeyColumn, $id)
->update([$orderColumnName => $startOrder++]);
}
Expand Down

0 comments on commit 027cf37

Please sign in to comment.