@php $filename = Route::currentRouteName(); // use route name instead of PHP_SELF $acronyms = ['ui', 'ai', 'js', 'api', 'css', 'html', 'php', 'seo', 'faq', 'rtl']; if ($filename === 'index') { $title = 'Admin Dashboard'; } else { $parts = explode('-', str_replace('ui-', '', strtolower($filename))); $hasIcon = false; $hasChart = false; $cleaned_parts = []; foreach ($parts as $part) { if ($part === 'icon') { $hasIcon = true; continue; } if ($part === 'chart') { $hasChart = true; continue; } if ($part === 'all') { continue; } $cleaned_parts[] = $part; } $formatted_parts = array_map(function ($word) use ($acronyms) { return in_array($word, $acronyms) ? strtoupper($word) : ucfirst($word); }, $cleaned_parts); if ($hasIcon) { $formatted_parts[] = 'Icons'; } if ($hasChart) { $formatted_parts[] = 'Charts'; } $title = implode(' ', $formatted_parts); } @endphp {{ $title }} | Dreams Timer - Time Tracking Boostrap 5 Admin Dashboard