publicRecords($model) as $record) { foreach ($locales as $locale) { $hasTitle = filled($record->getTranslation('title', $locale, false)); $hasSlug = filled($record->getTranslation('slug', $locale, false)); if ($hasTitle && ! $hasSlug) { $count++; $samples[] = $record->getTranslation('title', $locale, false)." ({$locale})"; } } } } return Finding::problem( $this->key(), $count, Severity::Error, samples: $samples, ); } /** * Only what the public can reach: a draft with half its slugs filled in is * work in progress, not a fault. * * @param class-string $model * @return iterable */ protected function publicRecords(string $model): iterable { $query = $model::query(); return match ($model) { Call::class => $query->open()->get(['id', 'title', 'slug']), default => $query->published()->get(['id', 'title', 'slug']), }; } }