title: How to display parent child flat table records as nested list in Php?
body: <p>I am creating a Laravel app. I have a self referencing table. I need to display the record as nested as shown below. </p>
  
  <p>Here is the entries in the table : </p>
  
  <pre><code>id            name              parent
  1             Task 1             0 
  2             Task 2             0
  3             Sub Task 1         1
  4             Sub Task 2         1
  5             Sub Task 3         2
  6             Task 3             0
  7             Sub Sub Task 1     4
  </code></pre>
  
  <p>The desired result is: </p>
  
  <pre><code>Task 1 
    Sub Task 1
    Sub Task 2 
      Sub Sub Task 1
   Task 2
    Sub Task 3
  Taks 3
  </code></pre>
  
  <p>Would you please let me know how can I do that? </p>
  
  <p>Thanks in advance.</p>