✨ 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:
@@ -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');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user