Code Duplication    Length = 15-15 lines in 2 locations

src/SortableTrait.php 2 locations

@@ 104-118 (lines=15) @@
101
     *
102
     * @return $this
103
     */
104
    public function moveOrderDown()
105
    {
106
        $orderColumnName = $this->determineOrderColumnName();
107
108
        $swapWithModel = static::limit(1)
109
            ->ordered()
110
            ->where($orderColumnName, '>', $this->$orderColumnName)
111
            ->first();
112
113
        if (! $swapWithModel) {
114
            return $this;
115
        }
116
117
        return $this->swapOrderWithModel($swapWithModel);
118
    }
119
120
    /**
121
     * Swaps the order of this model with the model 'above' this model.
@@ 125-139 (lines=15) @@
122
     *
123
     * @return $this
124
     */
125
    public function moveOrderUp()
126
    {
127
        $orderColumnName = $this->determineOrderColumnName();
128
129
        $swapWithModel = static::limit(1)
130
            ->ordered('desc')
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
     * Swap the order of this model with the order of another model.