Code Duplication    Length = 15-15 lines in 2 locations

src/SortableTrait.php 2 locations

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