Add narrator texts infrastructure with API (Story 3.1)

- Create narrator_texts table migration with context/hero_type indexes
- Add NarratorText model with getRandomText() for variant selection
- Add NarratorTextSeeder with 30+ texts for 11 contexts
- Implement vouvoiement (recruteur) vs tutoiement (client/dev)
- Create NarratorController with GET /api/narrator/{context}
- Add useFetchNarratorText composable for frontend

Contexts: intro, transitions, hints, encouragements, contact_unlocked, welcome_back

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-07 02:45:05 +01:00
parent e5eb9d0e78
commit c572af3072
9 changed files with 469 additions and 34 deletions

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('narrator_texts', function (Blueprint $table) {
$table->id();
$table->string('context');
$table->string('text_key');
$table->integer('variant')->default(1);
$table->enum('hero_type', ['recruteur', 'client', 'dev'])->nullable();
$table->timestamps();
$table->index('context');
$table->index(['context', 'hero_type']);
});
}
public function down(): void
{
Schema::dropIfExists('narrator_texts');
}
};