feat: add enums and helper functions
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
<?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 '';
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user