private function menusOrmToJsTreeJson(Collection $menusCol)
{
$jsTreeCol = $menusCol->map(function ($item, $key) {
$id = $item->id;
$parent_id = $item->parent_id;
$label = $item->label;
$icon = $item->icon;
// Fix attribute of root item for JSTree
if ($id == $parent_id && 'Root' == $label) {
$parent_id = '#';
}
return collect(['id' => $id, 'parent' => $parent_id, 'text' => $label, 'icon' => $icon]);
});
$menusJson = $jsTreeCol->toJson();
return $menusJson;
}