@php // PAUTAN BERKAITAN — data dari modul Content Application (kategori RELATED_LINKS). $frtLang = ($lang ?? session('locale', 'ms')) === 'en' ? 'en' : 'ms'; $frtRows = DB::table('content_applications') ->where('application_cat', 'RELATED_LINKS') ->where('application_status', 'ACTIVE') ->orderBy('application_sort') ->orderBy('application_id') ->get(); $frtIds = $frtRows->pluck('application_id')->all(); $frtTr = $frtIds ? DB::table('content_application_translations') ->whereIn('application_translation_parent_id', $frtIds) ->get() ->groupBy('application_translation_parent_id') : collect(); $frtLinks = []; foreach ($frtRows as $frtRow) { $rows = $frtTr[$frtRow->application_id] ?? collect(); $tr = $rows->firstWhere('application_translation_language', $frtLang) ?? $rows->firstWhere('application_translation_main', 1) ?? $rows->first(); $title = trim((string) ($tr->application_translation_title ?? '')); if ($title === '') { continue; } $frtLinks[] = [ 'title' => $title, 'url' => trim((string) $frtRow->application_url), ]; } // MEDIA SOSIAL — data dari modul Content Application (kategori SOCIAL_MEDIA). $frtSocRows = DB::table('content_applications') ->where('application_cat', 'SOCIAL_MEDIA') ->where('application_status', 'ACTIVE') ->orderBy('application_sort') ->orderBy('application_id') ->get(); $frtSocIds = $frtSocRows->pluck('application_id')->all(); $frtSocTr = $frtSocIds ? DB::table('content_application_translations') ->whereIn('application_translation_parent_id', $frtSocIds) ->get() ->groupBy('application_translation_parent_id') : collect(); $frtSocial = []; foreach ($frtSocRows as $frtSocRow) { $rows = $frtSocTr[$frtSocRow->application_id] ?? collect(); $tr = $rows->firstWhere('application_translation_language', $frtLang) ?? $rows->firstWhere('application_translation_main', 1) ?? $rows->first(); $icon = trim((string) $frtSocRow->application_icon); if ($icon === '') { continue; } $title = trim((string) ($tr->application_translation_title ?? '')); $frtSocial[] = [ 'title' => $title !== '' ? $title : trim((string) $frtSocRow->application_code), 'url' => trim((string) $frtSocRow->application_url), 'icon' => $icon, ]; } // Tarikh kemaskini — sentiasa tarikh HARI INI (BM/EN). $frtMonths = [ 'ms' => [1 => 'Januari', 'Februari', 'Mac', 'April', 'Mei', 'Jun', 'Julai', 'Ogos', 'September', 'Oktober', 'November', 'Disember'], 'en' => [1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], ]; $frtToday = now(); $frtUpdated = $frtToday->format('j').' '.($frtMonths[$frtLang][(int) $frtToday->format('n')] ?? '').' '.$frtToday->format('Y'); @endphp