@php
use Illuminate\Support\Str;
$hasChildren = isset($item->children) && $item->children->count();
$isMega = Str::lower(trim($item->title)) === 'programas';
$link = '#';
if (!empty($item->route)) {
try {
$params = $item->parameters ? json_decode($item->parameters, true) : [];
$link = route($item->route, $params ?? []);
} catch (\Throwable $e) {
$link = !empty($item->url) ? url($item->url) : '#';
}
} else {
$link = !empty($item->url) ? url($item->url) : '#';
}
$isActive = url()->current() === rtrim($link, '/')
|| request()->fullUrlIs(rtrim($link, '/') . '*');
$icon = $item->icon_class ?: 'voyager-angle-right';
@endphp
@if($desktop)
{{ $item->title }}
@if($hasChildren)
@endif
@if($hasChildren && !$isMega)
@foreach($item->children as $child)
@php
$childLink = '#';
if (!empty($child->route)) {
try {
$childParams = $child->parameters ? json_decode($child->parameters, true) : [];
$childLink = route($child->route, $childParams ?? []);
} catch (\Throwable $e) {
$childLink = !empty($child->url) ? url($child->url) : '#';
}
} else {
$childLink = !empty($child->url) ? url($child->url) : '#';
}
$childIcon = $child->icon_class ?: 'voyager-angle-right';
@endphp
-
{{ $child->title }}
@endforeach
@endif
@if($hasChildren && $isMega)
@foreach($item->children as $child)
@php
$childLink = '#';
if (!empty($child->route)) {
try {
$childParams = $child->parameters ? json_decode($child->parameters, true) : [];
$childLink = route($child->route, $childParams ?? []);
} catch (\Throwable $e) {
$childLink = !empty($child->url) ? url($child->url) : '#';
}
} else {
$childLink = !empty($child->url) ? url($child->url) : '#';
}
$childIcon = $child->icon_class ?: 'voyager-categories';
@endphp
{{ $child->title }}
@endforeach
@endif
@else
@if($hasChildren)
@foreach($item->children as $child)
@php
$childLink = '#';
if (!empty($child->route)) {
try {
$childParams = $child->parameters ? json_decode($child->parameters, true) : [];
$childLink = route($child->route, $childParams ?? []);
} catch (\Throwable $e) {
$childLink = !empty($child->url) ? url($child->url) : '#';
}
} else {
$childLink = !empty($child->url) ? url($child->url) : '#';
}
$childIcon = $child->icon_class ?: 'voyager-angle-right';
@endphp
-
{{ $child->title }}
@endforeach
@endif
@endif