@@ 84-98 (lines=15) @@ | ||
81 | return $this->sortable['sort_when_creating'] ?? true; |
|
82 | } |
|
83 | ||
84 | public function moveOrderDown() |
|
85 | { |
|
86 | $orderColumnName = $this->determineOrderColumnName(); |
|
87 | ||
88 | $swapWithModel = $this->buildSortQuery()->limit(1) |
|
89 | ->ordered() |
|
90 | ->where($orderColumnName, '>', $this->$orderColumnName) |
|
91 | ->first(); |
|
92 | ||
93 | if (! $swapWithModel) { |
|
94 | return $this; |
|
95 | } |
|
96 | ||
97 | return $this->swapOrderWithModel($swapWithModel); |
|
98 | } |
|
99 | ||
100 | public function moveOrderUp() |
|
101 | { |
|
@@ 100-114 (lines=15) @@ | ||
97 | return $this->swapOrderWithModel($swapWithModel); |
|
98 | } |
|
99 | ||
100 | public function moveOrderUp() |
|
101 | { |
|
102 | $orderColumnName = $this->determineOrderColumnName(); |
|
103 | ||
104 | $swapWithModel = $this->buildSortQuery()->limit(1) |
|
105 | ->ordered('desc') |
|
106 | ->where($orderColumnName, '<', $this->$orderColumnName) |
|
107 | ->first(); |
|
108 | ||
109 | if (! $swapWithModel) { |
|
110 | return $this; |
|
111 | } |
|
112 | ||
113 | return $this->swapOrderWithModel($swapWithModel); |
|
114 | } |
|
115 | ||
116 | public function swapOrderWithModel(Sortable $otherModel) |
|
117 | { |