Estoy necesitando ayuda para generar la estructura de datos solicitado por bootstrap-treeview (https://github.com/jonmiles/bootstrap-treeview)
En mi Tabla tengo: (id, padre_id, nombre)
Como puedo crear la siguiente estructura utilizando PHP?????
var tree = [
{
text: "Parent 1",
nodes: [
{
text: "Child 1",
nodes: [
{
text: "Grandchild 1"
},
{
text: "Grandchild 2"
}
]
},
{
text: "Child 2"
}
]
},
{
text: "Parent 2"
},
{
text: "Parent 3"
},
{
text: "Parent 4"
},
{
text: "Parent 5"
}
];