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