function dequy($parentid, $arr, $text = '')
{
    foreach ($arr as $key => $value) {
        if ($value->root == $parentid) {
            ?>
                                        <option value="{{$value->id}}">{{$text.$value->name}}</option>
                                        <?php 
            dequy($value->id, $arr, $text . '--');
        }
    }
}
function dequy($parentid, $arr, $datap, $res = '<i class="fa fa-mail-forward"></i>')
{
    foreach ($arr as $key => $subvalue) {
        if ($subvalue->root == $parentid) {
            ?>
 <tr class="submenu" data-column="{{$subvalue->id}}">
            <td></td>
            <td>
                <?php 
            echo $res;
            ?>
 <span>{{$subvalue->name}}</span>
                <div class="groupaction">
                        <a class="edit" data-toggle="modal" dataitem='{"action":"edit","title":"Sửa {{$subvalue->name}}","id":"{{$subvalue->id}}","url":"{{Asset('admin/website/menu/edit')}}","value":{"name":"{{$subvalue->name}}","url":"{{str_replace('pages/','',$subvalue->url)}}","root":"{{$subvalue->root}}"}}' data-target="#modaldialog" href='#'>Sửa</a>
                        <form method="post" action="{{Asset('admin/website/menu/delete')}}" class="remove" dataitem='{"id":"{{$subvalue->id}}","title":"{{$subvalue->name}}","url2":"{{$subvalue->url}}","root":"{{$subvalue->root}}","url":"{{Asset('admin/website/menu/delete')}}"}'>
                                <input type="submit" value="Xóa">
                        </form>
                 </div>
            </td>
             <td>
                 @if($subvalue->url=='')
                 Sản phẩm
                 @else
                     @foreach($datap as $item)
                        @if('pages/'.$item->url==$subvalue->url)
                            {{$item->name}}
                        @endif
                     @endforeach
                 @endif
            </td>
            <td>
                 {{date('d/m/Y H:i',strtotime($subvalue->created_at))}}
            </td>
            <td>
                 {{date('d/m/Y H:i',strtotime($subvalue->updated_at))}}
            </td>
            </tr>
                    <?php 
            dequy($subvalue->id, $arr, $datap, $res . ' <i class="fa fa-mail-forward"></i>');
        }
    }
}