# Guide - Vérifier une Inscription dans la Base de Données ## 📋 Méthodes de Vérification ### 1. Via Tinker (Recommandé - Le plus simple) #### A. Vérifier une inscription par email ```bash php artisan tinker ``` ```php // Trouver l'inscription par email $email = 'coulibaly.a@gmail.com'; // Remplacez par l'email utilisé $registration = \App\Models\Registration::where('email', $email) ->with(['event', 'pricingPlan', 'user']) ->latest() ->first(); // Afficher les informations principales echo "ID: " . $registration->id . "\n"; echo "Statut: " . $registration->status->value . "\n"; echo "Événement: " . $registration->event->name . "\n"; echo "Formule: " . $registration->pricingPlan->code . " - " . $registration->pricingPlan->title . "\n"; echo "Nom: " . $registration->first_name . " " . $registration->last_name . "\n"; echo "Email: " . $registration->email . "\n"; echo "Date de soumission: " . $registration->submitted_at . "\n"; echo "Email vérifié: " . ($registration->user->email_verified_at ? "Oui" : "Non") . "\n"; echo "Rôle utilisateur: " . $registration->user->roles->pluck('name')->implode(', ') . "\n"; ``` #### B. Vérifier toutes les inscriptions vérifiées ```php // Toutes les inscriptions vérifiées (status = submitted) $verified = \App\Models\Registration::where('status', 'submitted') ->with(['event', 'pricingPlan', 'user']) ->latest() ->get(); foreach ($verified as $reg) { echo "ID: {$reg->id} | {$reg->first_name} {$reg->last_name} | {$reg->email} | {$reg->event->name} | {$reg->pricingPlan->code}\n"; } ``` #### C. Vérifier les inscriptions non vérifiées (draft) ```php // Inscriptions en attente de vérification $pending = \App\Models\Registration::where('status', 'draft') ->with(['event', 'user']) ->latest() ->get(); echo "Inscriptions en attente: " . $pending->count() . "\n"; foreach ($pending as $reg) { echo "ID: {$reg->id} | {$reg->email} | {$reg->event->name} | Créée: {$reg->created_at}\n"; } ``` #### D. Vérifier le token de vérification ```php // Vérifier si un token existe et s'il a été utilisé $registrationId = 1; // ID de l'inscription $tokens = \DB::table('public_registration_tokens') ->where('registration_id', $registrationId) ->get(); foreach ($tokens as $token) { echo "Token ID: {$token->id}\n"; echo "Utilisé: " . ($token->used_at ? "Oui ({$token->used_at})" : "Non") . "\n"; echo "Expire: {$token->expires_at}\n"; echo "Créé: {$token->created_at}\n\n"; } ``` ### 2. Via les Logs Laravel Les logs contiennent des informations détaillées sur les inscriptions : ```bash # Voir les logs récents tail -f storage/logs/laravel.log # Ou sur Windows PowerShell Get-Content storage/logs/laravel.log -Tail 50 ``` **Rechercher dans les logs** : - `Inscription publique créée avec succès` : Inscription créée - `Inscription publique vérifiée avec succès` : Inscription vérifiée - `Email de vérification renvoyé` : Email renvoyé ### 3. Via SQL Direct (MySQL) ```sql -- Voir toutes les inscriptions vérifiées SELECT r.id, r.first_name, r.last_name, r.email, r.status, r.submitted_at, e.name as event_name, pp.code as plan_code, u.email_verified_at, GROUP_CONCAT(roles.name) as user_roles FROM registrations r JOIN events e ON r.event_id = e.id JOIN pricing_plans pp ON r.pricing_plan_id = pp.id JOIN users u ON r.user_id = u.id LEFT JOIN model_has_roles mhr ON u.id = mhr.model_id LEFT JOIN roles ON mhr.role_id = roles.id WHERE r.status = 'submitted' GROUP BY r.id ORDER BY r.submitted_at DESC; -- Voir les inscriptions en attente (draft) SELECT r.id, r.email, r.status, r.created_at, e.name as event_name FROM registrations r JOIN events e ON r.event_id = e.id WHERE r.status = 'draft' ORDER BY r.created_at DESC; ``` ### 4. Vérification Complète d'une Inscription ```php // Dans tinker $registrationId = 1; // ID de l'inscription à vérifier $reg = \App\Models\Registration::with(['event', 'pricingPlan', 'user.roles']) ->findOrFail($registrationId); // Informations de base echo "=== INSCRIPTION #{$reg->id} ===\n"; echo "Statut: {$reg->status->value}\n"; echo "Date création: {$reg->created_at}\n"; echo "Date soumission: " . ($reg->submitted_at ?? "Non soumise") . "\n\n"; // Informations personne echo "=== PERSONNE ===\n"; echo "Nom: {$reg->first_name} {$reg->last_name}\n"; echo "Email: {$reg->email}\n"; echo "Téléphone: {$reg->phone}\n"; echo "Pays: {$reg->country}\n"; echo "Ville: {$reg->city}\n\n"; // Informations événement echo "=== ÉVÉNEMENT ===\n"; echo "Nom: {$reg->event->name}\n"; echo "Type: {$reg->event->event_type->value}\n"; echo "Formule: {$reg->pricingPlan->code} - {$reg->pricingPlan->title}\n\n"; // Informations utilisateur echo "=== UTILISATEUR ===\n"; echo "ID: {$reg->user->id}\n"; echo "Email vérifié: " . ($reg->user->email_verified_at ? "Oui ({$reg->user->email_verified_at})" : "Non") . "\n"; echo "Rôles: " . $reg->user->roles->pluck('name')->implode(', ') . "\n\n"; // Informations spécifiques Sommet if ($reg->event->event_type->value === 'summit') { echo "=== OPTIONS SOMMET ===\n"; echo "Résident Ouaga: " . ($reg->ouaga_resident_confirmed ? "Oui" : "Non") . "\n"; echo "Conjoint: " . ($reg->spouse_fullname ?? "Non") . "\n\n"; } // Informations spécifiques Séminaire if ($reg->event->event_type->value === 'seminar') { echo "=== OPTIONS SÉMINAIRE ===\n"; echo "Intention: {$reg->seminar_intent}\n"; if ($reg->seminar_intent === 'recommend') { echo "Personne recommandée: {$reg->recommended_full_name}\n"; echo "Profession: {$reg->recommended_profession}\n"; } } ``` ## ✅ Indicateurs d'une Inscription Vérifiée Une inscription est **vérifiée** si : 1. ✅ `status` = `'submitted'` (pas `'draft'`) 2. ✅ `submitted_at` n'est pas `null` 3. ✅ `user.email_verified_at` n'est pas `null` 4. ✅ L'utilisateur a le rôle `'participant'` (pas `'guest'`) 5. ✅ Le token de vérification a `used_at` défini ## 🔍 Commandes Rapides ### Dernière inscription créée ```php \App\Models\Registration::latest()->first(); ``` ### Nombre d'inscriptions vérifiées ```php \App\Models\Registration::where('status', 'submitted')->count(); ``` ### Nombre d'inscriptions en attente ```php \App\Models\Registration::where('status', 'draft')->count(); ``` ### Inscriptions pour un événement spécifique ```php $eventSlug = 'sommet-haggai-franco-2026'; $event = \App\Models\Event::where('slug', $eventSlug)->first(); $registrations = \App\Models\Registration::where('event_id', $event->id) ->with(['pricingPlan', 'user']) ->get(); ``` --- **Note** : Remplacez les valeurs d'exemple (emails, IDs) par vos propres données.