@php
$path = '/'.Request::path();
// url 마지막이 int 일 경우 게시글 id로 판단하여 제거
$arrPath = explode('/', $path);
$lastTypeof = (int)$arrPath[count($arrPath)-1];
if ($lastTypeof) {
array_pop($arrPath);
$path = implode('/', $arrPath);
}
$currentMenu = Menu::where([['enable', '=', 'Y'],['type', '!=', 'gnb'],['type', '!=', 'mask'],['url', '=', $path]])->first();
@endphp
@if (!empty($currentMenu) && $currentMenu->type != 'submain' && $currentMenu->code != 'PROGRAMS' && $currentMenu->code != 'SCHOOLPICK' && $currentMenu->code != 'JUNIOR')
@php
$ancestors = $currentMenu->ancestors->pluck('children');
$depth = $ancestors->count();
if ($depth < 4) {
// 모바일 4depth 포지션 맞추기
for ($i = $depth; $i < 4; $i++) {
$ancestors->push([]);
}
}
$level = $currentMenu->ancestors->pluck('name');
$level->push($currentMenu->name);
@endphp
@foreach($ancestors as $key => $items)
-
@if ($items)
@for ($i = 1; $i < $level->count(); $i++)
@foreach ($items as $item)
@if ($level[$i] === $item->name && $item->enable === 'Y')
{{ $item->name }}
@endif
@endforeach
@endfor
@if (!$key)
@foreach ($items as $item)
@if ($item->type === 'gnb' && $item->enable === 'Y')
- {{ $item->name }}
@endif
@endforeach
@else
@foreach ($items as $item)
@if (!empty($item->type) && $item->enable === 'Y')
-
@if ($item->name === '카톡상담')
{{ $item->name }}
@else
{{ $item->name }}
@endif
@endif
@endforeach
@endif
@endif
@endforeach
@endif