Code Duplication    Length = 15-15 lines in 2 locations

src/SortableTrait.php 2 locations

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