Conditions | 2 |
Paths | 2 |
Total Lines | 7 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2 |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
32 | 2 | public function detachAll(HasAsset $model, ?string $type = null): void |
|
33 | { |
||
34 | 2 | $assetIds = $type |
|
35 | 1 | ? $model->assetRelation()->where('asset_pivots.type', $type)->get()->pluck('id') |
|
36 | 1 | : $model->assetRelation()->get()->pluck('id'); |
|
37 | |||
38 | 1 | $model->assetRelation()->detach($assetIds); |
|
39 | } |
||
50 |