title: How to Display Nested List with loop
body: <p>i am try to display nested list using Laravel.</p>
  
  <pre><code>class Person extends Model
  {
  
      public function father()
      {
          return $this-&gt;belongsTo('App\Person', 'father_id');
      } 
  }
  </code></pre>
  
  <p>I can access Data manually like bellow.</p>
  
  <pre><code>user      = \App\Person::find(5);
  $this-&gt;tree_string .= "&lt;li&gt;";
  $this-&gt;tree_string .= "&lt;label&gt;".$user-&gt;name."&lt;/label&gt;";
  $user = $user-&gt;father;
      $this-&gt;tree_string .= "&lt;ul&gt;&lt;li&gt;";
      $this-&gt;tree_string .= "&lt;label&gt;".$user-&gt;name."&lt;/label&gt;";
      $user = $user-&gt;father;
          $this-&gt;tree_string .= "&lt;ul&gt;&lt;li&gt;";
          $this-&gt;tree_string .= "&lt;label&gt;".$user-&gt;name."&lt;/label&gt;";
          $this-&gt;tree_string .= "&lt;/li&gt;&lt;/ul&gt;";
      $this-&gt;tree_string .= "&lt;/li&gt;&lt;/ul&gt;";
  $this-&gt;tree_string .= "&lt;/li&gt;";
  </code></pre>
  
  <p>but how do i do this in loop until there is no father.(like foreach)
  is the method i am using correct.</p>