| Total Complexity | 3 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | trait TranslationHandelTrait { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Override the applyFilters method to add the guard_name condition when filtering |
||
| 18 | * |
||
| 19 | * @param \Laravel\Nova\Http\Requests\NovaRequest $request |
||
| 20 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
| 21 | * @param array $filters |
||
| 22 | * @return \Illuminate\Database\Eloquent\Builder |
||
| 23 | */ |
||
| 24 | protected static function applyFilters(NovaRequest $request, $query, array $filters) |
||
| 25 | { |
||
| 26 | $query = parent::applyFilters($request, $query, $filters); |
||
| 27 | if($model = head($request->__memoized)){ |
||
| 28 | $guard_name = $model->guard_name ?? self::getGuardForModel(get_class($model)); |
||
| 29 | $query->where('guard_name', $guard_name); |
||
| 30 | } |
||
| 31 | |||
| 32 | return $query; |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param string model |
||
| 37 | * |
||
| 38 | * @return string|null |
||
| 39 | */ |
||
| 40 | public static function getGuardForModel(string $model) { |
||
| 46 | } |
||
| 47 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths