| Conditions | 2 |
| Paths | 2 |
| Total Lines | 9 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 4 | public function handle(HasAsset $model, $sorting, $type, $locale) |
|
| 18 | { |
||
| 19 | 4 | $assets = $model->assetRelation()->where('asset_pivots.type', $type)->where('asset_pivots.locale', $locale)->get(); |
|
| 20 | |||
| 21 | 4 | foreach ($assets as $asset) { |
|
| 22 | 4 | $pivot = $asset->pivot; |
|
| 23 | 4 | $pivot->order = array_search($asset->id, $sorting); |
|
| 24 | |||
| 25 | 4 | $pivot->save(); |
|
| 26 | } |
||
| 29 |