@php $sub = function ($menu,$sub_level,$id_parent){ $sub_menu = DB::table('menu')->where('menu_parent',$menu)->get(); if(!empty($sub_menu)) { $sub_level++; foreach ($sub_menu as $value) { $sparator=''; for($z=0;$z<$sub_level;$z++) { $sparator .='---'; } echo ''; } } }; @endphp