| Total Complexity | 7 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | trait HasPosition |
||
| 6 | { |
||
| 7 | |||
| 8 | protected static function bootHasPosition() |
||
| 9 | { |
||
| 10 | static::creating(function ($model) { |
||
| 11 | $model->setToLastPosition(); |
||
| 12 | }); |
||
| 13 | } |
||
| 14 | |||
| 15 | protected function setToLastPosition() |
||
| 18 | } |
||
| 19 | |||
| 20 | protected function getCurrentLastPosition() |
||
| 23 | } |
||
| 24 | |||
| 25 | public function scopeOrdered($query) |
||
| 26 | { |
||
| 27 | return $query->orderBy('position'); |
||
| 28 | } |
||
| 29 | |||
| 30 | public static function setNewOrder($ids, $startOrder = 1) |
||
| 40 | } |
||
| 41 | } |
||
| 42 | } |
||
| 43 |