@@ 97-111 (lines=15) @@ | ||
94 | return $this->sortable['sort_when_creating'] ?? true; |
|
95 | } |
|
96 | ||
97 | public function moveOrderDown() |
|
98 | { |
|
99 | $orderColumnName = $this->determineOrderColumnName(); |
|
100 | ||
101 | $swapWithModel = $this->buildSortQuery()->limit(1) |
|
102 | ->ordered() |
|
103 | ->where($orderColumnName, '>', $this->$orderColumnName) |
|
104 | ->first(); |
|
105 | ||
106 | if (! $swapWithModel) { |
|
107 | return $this; |
|
108 | } |
|
109 | ||
110 | return $this->swapOrderWithModel($swapWithModel); |
|
111 | } |
|
112 | ||
113 | public function moveOrderUp() |
|
114 | { |
|
@@ 113-127 (lines=15) @@ | ||
110 | return $this->swapOrderWithModel($swapWithModel); |
|
111 | } |
|
112 | ||
113 | public function moveOrderUp() |
|
114 | { |
|
115 | $orderColumnName = $this->determineOrderColumnName(); |
|
116 | ||
117 | $swapWithModel = $this->buildSortQuery()->limit(1) |
|
118 | ->ordered('desc') |
|
119 | ->where($orderColumnName, '<', $this->$orderColumnName) |
|
120 | ->first(); |
|
121 | ||
122 | if (! $swapWithModel) { |
|
123 | return $this; |
|
124 | } |
|
125 | ||
126 | return $this->swapOrderWithModel($swapWithModel); |
|
127 | } |
|
128 | ||
129 | public function swapOrderWithModel(Sortable $otherModel) |
|
130 | { |