@php $pageTitle = $requirement?->localized('meta_title') ?: "{$visaType->display_name}: {$fromCountry->display_name} to {$toCountry->display_name}"; $pageDescription = $requirement?->localized('meta_description') ?: "Complete guide to applying for a {$visaType->display_name} from {$fromCountry->display_name} to {$toCountry->display_name}."; // RTL arrow normalization: any "→" inside server-rendered titles should // become "←" so the visual direction matches the reading flow. if ($isRtl ?? false) { $pageTitle = str_replace('→', '←', $pageTitle); $pageDescription = str_replace('→', '←', $pageDescription); } $localizedSummary = $requirement?->localized('summary'); $localizedDocuments = $requirement?->localized('documents'); $localizedApplicationMethods = $requirement?->localized('application_methods'); $localizedCommonMistakes = $requirement?->localized('common_mistakes'); // ContentEnricher patches bilingual leftovers in seeded text — converts // "Tokyo"/"JPY"/"Asia"/"Japanese" inline to the active locale so the page // doesn't read as broken English-in-Arabic. $enricher = app(\App\Services\ContentEnricher::class); $localeForEnrich = $currentLocale ?? 'en'; $localizedSummary = $enricher->enrichText($localizedSummary, $localeForEnrich); $pageTitle = $enricher->enrichText($pageTitle, $localeForEnrich); $pageDescription = $enricher->enrichText($pageDescription, $localeForEnrich); // Localized country facts for the rich "About destination" section. $destinationFacts = $enricher->countryFacts($toCountry, $localeForEnrich); $sourceFacts = $enricher->countryFacts($fromCountry, $localeForEnrich); // Enrich list-shaped seeded content so the JSON-LD HowTo schema consumes // locale-pure text. FAQs get an enriched parallel map (we do NOT mutate // the Eloquent models — that fails when attribute casts intercept). if (is_array($localizedDocuments)) { $localizedDocuments = array_map(fn ($s) => $enricher->enrichText((string) $s, $localeForEnrich), $localizedDocuments); } if (is_array($localizedApplicationMethods)) { $localizedApplicationMethods = array_map(fn ($s) => $enricher->enrichText((string) $s, $localeForEnrich), $localizedApplicationMethods); } if (is_array($localizedCommonMistakes)) { $localizedCommonMistakes = array_map(fn ($s) => $enricher->enrichText((string) $s, $localeForEnrich), $localizedCommonMistakes); } // Parallel enriched FAQs for both schema + visible markup; keyed by faq->id. $enrichedFaqs = []; if ($requirement && $requirement->faqs->isNotEmpty()) { foreach ($requirement->faqs as $faq) { $enrichedFaqs[$faq->id] = [ 'question' => $enricher->enrichText((string) ($faq->question ?? ''), $localeForEnrich), 'answer' => $enricher->enrichText((string) ($faq->answer ?? ''), $localeForEnrich), ]; } } // Visa-type-specific FAQs (work, student, business, tourist). These augment // the generic FAQs from the DB with questions visitors actually search for. // Stored as a flat list rendered after the DB FAQs in the existing #faqs section. $typeSpecificFaqs = (function () use ($visaType, $fromCountry, $toCountry, $currentLocale, $requirement) { $type = $visaType->slug ?? ''; $loc = $currentLocale ?? 'en'; $from = $fromCountry->display_name; $to = $toCountry->display_name; $fee = $requirement?->fee_usd ? '$'.intval($requirement->fee_usd) : ''; $max = $requirement?->max_stay_days ?? null; $proc = $requirement?->processing_days_max ?? null; $pool = []; if (str_contains($type, 'work')) { $pool = match ($loc) { 'ar' => [ ['هل أحتاج كفيلاً أو صاحب عمل في {$to} قبل التقديم؟', "نعم. تأشيرة العمل في {$to} تتطلّب في الغالب عرضاً وظيفياً موثّقاً من صاحب عمل مسجّل محلياً، يتولى تقديم الطلب بالنيابة عنك. لا تستطيع التق VisaCross Aller au contenu
VisaCross VisaCross
🇫🇷