@php use Carbon\Carbon; $toBanglaDigits = static function (string $value): string { return strtr($value, [ '0' => '০', '1' => '১', '2' => '২', '3' => '৩', '4' => '৪', '5' => '৫', '6' => '৬', '7' => '৭', '8' => '৮', '9' => '৯', ]); }; $timezone = config('site.timezone', 'Asia/Dhaka'); $nowDhaka = Carbon::now($timezone); // Chattogram, Bangladesh coordinates $chattogramLat = 22.3569; $chattogramLon = 91.7832; $ramadanStart = Carbon::create(2026, 2, 18, 0, 0, 0, $timezone); $ramadanEnd = Carbon::create(2026, 3, 20, 23, 59, 59, $timezone); $isRamadan2026 = $nowDhaka->between($ramadanStart, $ramadanEnd); $sunInfo = date_sun_info($nowDhaka->timestamp, $chattogramLat, $chattogramLon); $sehriTs = $sunInfo['astronomical_twilight_begin'] ?? false; $iftarTs = $sunInfo['sunset'] ?? false; $formatTimeBn = static function ($timestamp) use ($timezone, $toBanglaDigits): string { if (!$timestamp || $timestamp === true) { return '--:--'; } $dt = Carbon::createFromTimestamp($timestamp, $timezone); return $toBanglaDigits($dt->format('g:i')) . ' ' . $dt->format('A'); }; $sehriTimeLabel = $formatTimeBn($sehriTs); $iftarTimeLabel = $formatTimeBn($iftarTs); $nextEventText = null; if ($sehriTs && $iftarTs && $sehriTs !== true && $iftarTs !== true) { $sehriAt = Carbon::createFromTimestamp($sehriTs, $timezone); $iftarAt = Carbon::createFromTimestamp($iftarTs, $timezone); $nextEventAt = null; $nextEventName = null; if ($nowDhaka->lt($sehriAt)) { $nextEventAt = $sehriAt; $nextEventName = 'সেহরি শেষ'; } elseif ($nowDhaka->lt($iftarAt)) { $nextEventAt = $iftarAt; $nextEventName = 'ইফতার'; } else { $tomorrowSun = date_sun_info($nowDhaka->copy()->addDay()->timestamp, $chattogramLat, $chattogramLon); $tomorrowSehriTs = $tomorrowSun['astronomical_twilight_begin'] ?? false; if ($tomorrowSehriTs && $tomorrowSehriTs !== true) { $nextEventAt = Carbon::createFromTimestamp($tomorrowSehriTs, $timezone); $nextEventName = 'আগামীকালের সেহরি শেষ'; } } if ($nextEventAt && $nextEventName) { $minutesLeft = $nowDhaka->diffInMinutes($nextEventAt); $hours = intdiv($minutesLeft, 60); $minutes = $minutesLeft % 60; $nextEventText = 'চট্টগ্রাম: ' . $nextEventName . ' বাকি ' . $toBanglaDigits((string) $hours) . 'ঘ ' . $toBanglaDigits((string) $minutes) . 'মি'; } } $hasHeaderAd = \App\Models\Ad::byPlacement('header')->exists(); $defaultLogoPath = 'images/logo.png'; $defaultLogoSrc = file_exists(public_path($defaultLogoPath)) ? asset($defaultLogoPath) : null; $logoUrl = config('site.logo_url'); $logoSrc = null; if ($logoUrl) { if (str_starts_with($logoUrl, 'http://') || str_starts_with($logoUrl, 'https://')) { $logoSrc = $logoUrl; } else { $normalizedPath = ltrim($logoUrl, '/'); $storageRelative = ltrim(str_replace('storage/', '', $normalizedPath), '/'); if (file_exists(public_path($normalizedPath))) { $logoSrc = asset($normalizedPath); } elseif (file_exists(public_path('storage/' . $storageRelative))) { $logoSrc = asset('storage/' . $storageRelative); } } } if (!$logoSrc && $defaultLogoSrc) { $logoSrc = $defaultLogoSrc; } @endphp
বাংলা সংস্করণ ই-পেপার