Epic 4: Chemins Narratifs, Challenge & Contact Stories implementees: - 4.1: Composant ChoiceCards pour choix narratifs binaires - 4.2: Sequence d'intro narrative avec Le Bug - 4.3: Chemins narratifs differencies avec useNarrativePath - 4.4: Table easter_eggs et systeme de detection (API + composable) - 4.5: Easter eggs UI (popup, notification, collection) - 4.6: Page challenge avec puzzle de code - 4.7: Page revelation "Monde de Code" - 4.8: Page contact avec formulaire et stats Fichiers crees: - Frontend: ChoiceCards, IntroSequence, ZoneEndChoice, EasterEggPopup, CodePuzzle, ChallengeSuccess, CodeWorld, et pages intro/challenge/revelation - API: EasterEggController, Model, Migration, Seeder Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
40 lines
839 B
PHP
40 lines
839 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class EasterEgg extends Model
|
|
{
|
|
protected $fillable = [
|
|
'slug',
|
|
'location',
|
|
'trigger_type',
|
|
'reward_type',
|
|
'reward_key',
|
|
'difficulty',
|
|
'is_active',
|
|
];
|
|
|
|
protected $casts = [
|
|
'difficulty' => 'integer',
|
|
'is_active' => 'boolean',
|
|
];
|
|
|
|
public function scopeActive(Builder $query): Builder
|
|
{
|
|
return $query->where('is_active', true);
|
|
}
|
|
|
|
public function scopeByLocation(Builder $query, string $location): Builder
|
|
{
|
|
return $query->where('location', $location);
|
|
}
|
|
|
|
public function getReward(string $lang = 'fr'): ?string
|
|
{
|
|
return Translation::getTranslation($this->reward_key, $lang);
|
|
}
|
|
}
|