@extends('layouts.default', ['appTopMenu' => true]) @section('title', 'Menu Management') @push('head') @endpush @section('content')

Roles/Post/Section

@csrf

Menus

@php $cntr=0; $array_string = ''; @endphp @if (!empty($allMenus)) @if (count($allMenus) > 0) @foreach ($allMenus as $item) @php $l2 = ''; $l3 = ''; $l4 = ''; $cntr++; $temp_m1=explode('#',$item->menu1); $array_string .= '{ id: "t_'.$temp_m1[0].'", text: "' . $temp_m1[1] . '"'; @endphp @if (!empty($item->menu2)) @php $array_string .= ', children: ['; // echo $item->menu2 . '

'; // $item->menu2 = trim($item->menu2, '|L2|'); $item_menu2 = ltrim($item->menu2, "|LTWO|"); // echo $item_menu2 . '

'; $arr_l2 = explode('|LTWO|', $item_menu2); $l2 = ''; if (count($arr_l2) > 0) { for ($i = 0; $i < count($arr_l2); $i++) { $pos = strpos($arr_l2[$i], '|LTHREE|'); if ($pos === false) { $temp_m2=explode('#',$arr_l2[$i]); $array_string .= '{id: "t_'.$temp_m2[0].'",text: "'.$temp_m2[1].'"},'; } else{//L3 exist $arr_l3 = explode('|LTHREE|', $arr_l2[$i]); $temp_m2=explode('#',$arr_l3[0]); $array_string .= '{id: "t_'.$temp_m2[0].'",text: "'.$temp_m2[1].'", children:['; // echo count($arr_l3) . '-l2B=' . $arr_l2[$i] . '
'; if (count($arr_l3) > 0) { for ($j = 1; $j < count($arr_l3); $j++) { $pos = strpos($arr_l3[$j], '|LFOUR|'); if ($pos === false) { $temp_m3=explode('#',$arr_l3[$j]); $array_string .= '{id: "t_'.$temp_m3[0].'",text: "'.$temp_m3[1].'"},'; } else{//L4 exists $arr_l4 = explode('|LFOUR|', $arr_l3[$j]); $temp_m3=explode('#',$arr_l4[0]); $array_string .= '{id: "t_'.$temp_m3[0].'",text: "'.$temp_m3[1].'", children:['; if (count($arr_l4) > 1) { for ($k = 1; $k < count($arr_l4); $k++) { $temp_m4=explode('#',$arr_l4[$k]); $array_string .= '{id: "t_'.$temp_m4[0].'",text: "'.$temp_m4[1].'"},'; } //endfor k } $array_string=trim($array_string,','); $array_string .= ']},'; } } //endfor j } $array_string=trim($array_string,','); $array_string .= ']},'; }//end else } //endfor i } // $array_string .= '},'; //end menu2 $array_string=trim($array_string,','); $array_string .= ']'; @endphp @endif @php $array_string .= '},'; @endphp @endforeach @endif @endif
@endsection @push('scripts') @endpush