Code Duplication    Length = 15-15 lines in 2 locations

src/SortableTrait.php 2 locations

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