Code Duplication    Length = 15-15 lines in 2 locations

src/SortableTrait.php 2 locations

@@ 116-130 (lines=15) @@
113
     *
114
     * @return $this
115
     */
116
    public function moveOrderDown()
117
    {
118
        $orderColumnName = $this->determineOrderColumnName();
119
120
        $swapWithModel = static::limit(1)
121
            ->ordered()
122
            ->where($orderColumnName, '>', $this->$orderColumnName)
123
            ->first();
124
125
        if (!$swapWithModel) {
126
            return $this;
127
        }
128
129
        return $this->swapOrderWithModel($swapWithModel);
130
    }
131
132
    /**
133
     * Swaps the order of this model with the model 'above' this model.
@@ 137-151 (lines=15) @@
134
     *
135
     * @return $this
136
     */
137
    public function moveOrderUp()
138
    {
139
        $orderColumnName = $this->determineOrderColumnName();
140
141
        $swapWithModel = static::limit(1)
142
            ->ordered('desc')
143
            ->where($orderColumnName, '<', $this->$orderColumnName)
144
            ->first();
145
146
        if (!$swapWithModel) {
147
            return $this;
148
        }
149
150
        return $this->swapOrderWithModel($swapWithModel);
151
    }
152
153
    /**
154
     * Swap the order of this model with the order of another model.