@foreach ($mainMenus as $menu)
@php
// URL for the current menu item
$url = is_numeric($menu->url) ? url('page/' . $menu->url) : url($menu->url);
// Check if the current URL matches the menu URL
$isActive = Request::is(trim(parse_url($url, PHP_URL_PATH), '/')) || url()->current() == $url;
$subItems = $subMenus->where('submenu_id', $menu->menu_id);
@endphp