Code Duplication    Length = 15-15 lines in 2 locations

src/SortableTrait.php 2 locations

@@ 126-140 (lines=15) @@
123
     *
124
     * @return $this
125
     */
126
    public function moveOrderDown()
127
    {
128
        $orderColumnName = $this->determineOrderColumnName();
129
130
        $swapWithModel = $this->buildSortQuery()->limit(1)
131
            ->ordered()
132
            ->where($orderColumnName, '>', $this->$orderColumnName)
133
            ->first();
134
135
        if (! $swapWithModel) {
136
            return $this;
137
        }
138
139
        return $this->swapOrderWithModel($swapWithModel);
140
    }
141
142
    /**
143
     * Swaps the order of this model with the model 'above' this model.
@@ 147-161 (lines=15) @@
144
     *
145
     * @return $this
146
     */
147
    public function moveOrderUp()
148
    {
149
        $orderColumnName = $this->determineOrderColumnName();
150
151
        $swapWithModel = $this->buildSortQuery()->limit(1)
152
            ->ordered('desc')
153
            ->where($orderColumnName, '<', $this->$orderColumnName)
154
            ->first();
155
156
        if (! $swapWithModel) {
157
            return $this;
158
        }
159
160
        return $this->swapOrderWithModel($swapWithModel);
161
    }
162
163
    /**
164
     * Swap the order of this model with the order of another model.