title: Laravel multiple controller functions one route
body: <p>What I'm trying to achieve is post all news by @foreach and between the @foreach do another @foreach to post all comments with the ID from the news post.</p>
  
  <p>I'm unsure on how to pass this ID, to the getNewsComments function.</p>
  
  <p>My controller:</p>
  
  <pre><code>namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use DB;
  use App\News;
  use App\newsComments;
  
  
  class newsController extends Controller
  {
      public function getAllNews(){
          $results = News::all();
          return view('index')-&gt;with('news', $results);
      }
  }
  </code></pre>
  
  <p>Route:</p>
  
  <pre><code>Route::get('/', 'newsController@getAllNews');
  </code></pre>
  
  <p>News model:</p>
  
  <pre><code>class News extends Model
  {
      // set table
      protected $table = 'lg_news';
  
  
      public function newsComments(){
          return $this-&gt;hasMany('App\newsCommments');
      }
  }
  </code></pre>
  
  <p>Comment model:</p>
  
  <pre><code>class newsComments extends Model
  {
      // set table name
      protected $table = 'lg_newscomments';
  
  }
  </code></pre>
  
  <p>view</p>
  
  <pre><code>@foreach ($news as $article)
  
    @foreach($news-&gt;$newsComments as $comment)
    @endforeach
  @endforeach
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Undefined variable: newsComments (View:
    C:\xampp\htdocs\resources\views\index.blade.php)</p>
  </blockquote>