Files

20 lines
463 B
PHP

<?php
function ActiveAdminSidebar(array $routes): string
{
$currentRouteName = Route::currentRouteName();
if (in_array($currentRouteName, $routes)) {
return 'active';
}
// برای مسیرهایی که پیشوند دارند (مثلاً admin.tours.*)
foreach ($routes as $route) {
if ($currentRouteName && str_starts_with($currentRouteName, $route . '.')) {
return 'active';
}
}
return '';
}