presseportale/database/factories/PressReleaseIndexCheckFactory.php
Kevin Adametz 6b8728242f admin: Indexierungsstatus aus der Search Console, Kundenansicht vorbereitet und zu (Anhang 1: 1c.4, E8)
press-releases:check-index-status fragt täglich je Portal ein Kontingent
veröffentlichter Meldungen über die URL Inspection API ab, nach Alter
gestaffelt, nie geprüfte zuerst. Jede Antwort wird als Momentaufnahme in
press_release_index_checks gespeichert; der reduzierte Befund (IndexState)
trennt „noch nicht gecrawlt" von „gecrawlt, nicht indexiert".

Client authentifiziert sich als Service-Konto über ein selbst signiertes
JWT — kein Google-SDK. Admin ▸ Reports ▸ Indexierung zeigt die Verteilung
je Portal getrennt nach Direkteinreichung und Syndikation (Status-Log
source=api; Altbestand ohne Log zählt als direkt).

Das Kundenpanel heißt jetzt „Auslieferung", zeigt Sitemap-Datum und die
Abrufe durch Such- und KI-Dienste mit dem Satz „Ein Abruf ist kein Zitat";
der Google-Index-Block hängt an GSC_CUSTOMER_VISIBLE (false).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 14:21:51 +00:00

46 lines
1.3 KiB
PHP

<?php
namespace Database\Factories;
use App\Enums\IndexState;
use App\Enums\Portal;
use App\Models\PressRelease;
use App\Models\PressReleaseIndexCheck;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<PressReleaseIndexCheck>
*/
class PressReleaseIndexCheckFactory extends Factory
{
/**
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'press_release_id' => PressRelease::factory(),
'portal' => Portal::Presseecho,
'url' => 'https://presseecho.test/de/press-release/'.fake()->slug(),
'state' => IndexState::Indexed,
'verdict' => 'PASS',
'coverage_state' => 'Submitted and indexed',
'indexing_state' => 'INDEXING_ALLOWED',
'robots_txt_state' => 'ALLOWED',
'page_fetch_state' => 'SUCCESSFUL',
'last_crawl_time' => now()->subDay(),
'google_canonical' => null,
'raw' => null,
'checked_at' => now(),
];
}
public function withState(IndexState $state): static
{
return $this->state([
'state' => $state,
'verdict' => $state === IndexState::Indexed ? 'PASS' : 'NEUTRAL',
'last_crawl_time' => $state === IndexState::NotCrawled ? null : now()->subDay(),
]);
}
}