| Conditions | 4 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 44 | 1 | public function delete(Model $model, string $key): bool |
|
| 45 | { |
||
| 46 | 1 | $setting = app(ReadableService::class) |
|
| 47 | 1 | ->getSetting($model, $key); |
|
| 48 | |||
| 49 | 1 | if ($setting) { |
|
| 50 | /** |
||
| 51 | * @var Collection $collection |
||
| 52 | */ |
||
| 53 | 1 | $collection = $model->settings; |
|
| 54 | 1 | foreach ($collection as $index => $item) { |
|
| 55 | 1 | if ($item === $setting) { |
|
| 56 | 1 | $collection->forget($index); |
|
| 57 | 1 | break; |
|
| 58 | } |
||
| 59 | } |
||
| 60 | |||
| 61 | 1 | return $setting->delete(); |
|
| 62 | } |
||
| 63 | |||
| 64 | 1 | return false; |
|
| 65 | } |
||
| 68 |