| Conditions | 3 |
| Paths | 4 |
| Total Lines | 12 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | protected static function execute(Builder $query, array $value, bool $has = true): Builder |
||
| 33 | { |
||
| 34 | // use `has()` method for scoping to models WITH particular relationships |
||
| 35 | // use `doesntHave()` method for scoping to models WITHOUT particular relationships |
||
| 36 | $method = $has ? 'has' : 'doesntHave'; |
||
| 37 | |||
| 38 | // Add scope for each relationship |
||
| 39 | foreach (array_keys((array) $value) as $relationship) { |
||
| 40 | $query->{$method}($relationship); |
||
| 41 | } |
||
| 42 | |||
| 43 | return $query; |
||
| 44 | } |
||
| 46 |