Link:  https://www.codechief.org/article/laravel-treeview-structure-and-display-hierarchical-data-example

I was working on an application where I had to create a hierarchical relationship for a Model entity and also figure out a way to display it in HTML.

laravel model entity

I decided to write an article on this as I came across similar questions over the internet and the process which I have gone through might help someone looking for a similar solution.

In this tutorial, I create "categories" table and manage end level of parents and child category with nested tree view structure in Laravel application. I use jquery to make tree view layout and child relationship with the category model for hierarchical data. I also add a form for creating a new category in the tree view.