Completed
Pull Request — master (#48)
by
unknown
04:58
created
src/SortableTrait.php 1 patch
Spacing   +10 added lines, -10 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
             }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public static function setNewOrder($ids, int $startOrder = 1)
62 62
     {
63
-        if (! is_array($ids) && ! $ids instanceof ArrayAccess) {
63
+        if (!is_array($ids) && !$ids instanceof ArrayAccess) {
64 64
             throw new InvalidArgumentException('You must pass an array or ArrayAccess object to setNewOrder');
65 65
         }
66 66
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     {
84 84
         if (
85 85
             isset($this->sortable['order_column_name']) &&
86
-            ! empty($this->sortable['order_column_name'])
86
+            !empty($this->sortable['order_column_name'])
87 87
         ) {
88 88
             return $this->sortable['order_column_name'];
89 89
         }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             ->where($orderColumnName, '>', $this->$orderColumnName)
114 114
             ->first();
115 115
 
116
-        if (! $swapWithModel) {
116
+        if (!$swapWithModel) {
117 117
             return $this;
118 118
         }
119 119
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             ->where($orderColumnName, '<', $this->$orderColumnName)
135 135
             ->first();
136 136
 
137
-        if (! $swapWithModel) {
137
+        if (!$swapWithModel) {
138 138
             return $this;
139 139
         }
140 140
 
@@ -238,18 +238,18 @@  discard block
 block discarded – undo
238 238
 
239 239
         if (
240 240
             isset($this->sortable['order_unique']) &&
241
-            ! empty($this->sortable['order_unique'])
241
+            !empty($this->sortable['order_unique'])
242 242
         ) {
243
-            if(is_array($this->sortable['order_unique'])) {
244
-                foreach($this->sortable['order_unique'] as $key){
245
-                    if(empty($this->$key)){
243
+            if (is_array($this->sortable['order_unique'])) {
244
+                foreach ($this->sortable['order_unique'] as $key) {
245
+                    if (empty($this->$key)) {
246 246
                         throw new \Exception('Unique sorting key must be set first ('.$key.')');
247 247
                     }
248 248
                     $query->where($key, '=', $this->$key);
249 249
                 }
250 250
             } else {
251 251
                 $key = $this->sortable['order_unique'];
252
-                if(empty($this->$key)){
252
+                if (empty($this->$key)) {
253 253
                     throw new \Exception('Unique sorting key must be set first ('.$key.')');
254 254
                 }
255 255
                 $query->where($key, '=', $this->$key);
Please login to merge, or discard this patch.