Completed
Pull Request — master (#80)
by
unknown
01:26
created
src/SortableTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 {
12 12
     public static function bootSortableTrait()
13 13
     {
14
-        static::creating(function ($model) {
14
+        static::creating(function($model) {
15 15
             if ($model instanceof Sortable && $model->shouldSortWhenCreating()) {
16 16
                 $model->setHighestOrderNumber();
17 17
             }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     public static function setNewOrder($ids, int $startOrder = 1, string $primaryKeyColumn = null)
39 39
     {
40
-        if (! is_array($ids) && ! $ids instanceof ArrayAccess) {
40
+        if (!is_array($ids) && !$ids instanceof ArrayAccess) {
41 41
             throw new InvalidArgumentException('You must pass an array or ArrayAccess object to setNewOrder');
42 42
         }
43 43
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
         if (
67 67
             isset($this->sortable['order_column_name']) &&
68
-            ! empty($this->sortable['order_column_name'])
68
+            !empty($this->sortable['order_column_name'])
69 69
         ) {
70 70
             return $this->sortable['order_column_name'];
71 71
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             ->where($orderColumnName, '>', $this->$orderColumnName)
91 91
             ->first();
92 92
 
93
-        if (! $swapWithModel) {
93
+        if (!$swapWithModel) {
94 94
             return $this;
95 95
         }
96 96
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             ->where($orderColumnName, '<', $this->$orderColumnName)
107 107
             ->first();
108 108
 
109
-        if (! $swapWithModel) {
109
+        if (!$swapWithModel) {
110 110
             return $this;
111 111
         }
112 112
 
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
 
186 186
         if ($oldOrder >= $targetPosition) {
187 187
             $this->buildSortQuery()
188
-                ->where($orderColumnName, '>=' ,$targetPosition)
189
-                ->where($orderColumnName, '<' ,$oldOrder)
188
+                ->where($orderColumnName, '>=', $targetPosition)
189
+                ->where($orderColumnName, '<', $oldOrder)
190 190
                 ->increment($orderColumnName);
191 191
         } else {
192 192
             $this->buildSortQuery()
193
-                ->where($orderColumnName, '<=' ,$targetPosition)
194
-                ->where($orderColumnName, '>' ,$oldOrder)
193
+                ->where($orderColumnName, '<=', $targetPosition)
194
+                ->where($orderColumnName, '>', $oldOrder)
195 195
                 ->decrement($orderColumnName);
196 196
         }
197 197
 
Please login to merge, or discard this patch.