| Conditions | 2 |
| Paths | 1 |
| Total Lines | 8 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | 2 | public function handle(HasAsset $model, $type, $sorting) |
|
| 20 | { |
||
| 21 | 2 | $files = $model->assets($type); |
|
|
|
|||
| 22 | $files->each(function ($asset) use ($model, $sorting) { |
||
| 23 | 2 | if (in_array($asset->id, $sorting)) { |
|
| 24 | 2 | $pivot = $model->assetRelation->find($asset->id)->pivot; |
|
| 25 | 2 | $pivot->order = array_search($asset->id, $sorting); |
|
| 26 | 2 | $pivot->save(); |
|
| 27 | } |
||
| 31 |