title: LARAVEL - Not able to call a function inside a controller method
body: <p>Here is comment method of CommentController</p>
  
  <pre><code>public function comment(Request $request)
  {
  
      $comments = DB::table('comments')
                      -&gt;join('answers', 'answers.id' , '=', 'comments.answer_id')
                      -&gt;join('users' , 'users.id' , '=', 'comments.user_id')
                      -&gt;where('answers.id', '=' , '9')
                      -&gt;where('parent_id', '0')
                      -&gt;select('comments.comment as comment',
                               'comments.id as comment_id',
                               'comments.created_at as created_at',
                               'comments.parent_id as parent_id',
                               // 'answers.aanswer as answer',
                               'answers.id as ans_id')
                      -&gt;orderBy('created_at', 'desc')
                      -&gt;get();
  
  
      foreach ($comments as $comment) {
           echo $comment-&gt;comment_id.$comment-&gt;comment.'&lt;br&gt;';
          return $this-&gt;testingComment();
      }
  
  
      public function testingComment(){
          echo "testing comments function";
      }
  
  }
  </code></pre>
  
  <p><strong>I have this foreach loop  , I am just t trying to call this testingComment function in loop, but its not working.</strong></p>
  
  <p>I am building a nested comment system and i want to call function inside foreach loop to render child and sub child comments when a  when a parent_id matches</p>