title: Two variables in one foreach statement laravel
body: <p>The first @foreach below brings the user who created the post. I need the output to be the user who shared the post, which is returned by the second @foreach below.</p>
  
  <p>First Foreach :</p>
  
  <pre><code>@foreach ($friendShares as $friendShare)
  &lt;p&gt; {{$friendShare-&gt;body}} by {{$friendShare-&gt;user-&gt;getname()}}&lt;/p&gt; 
  @endforeach
  </code></pre>
  
  <p>Second Foreach :</p>
  
  <pre><code>@foreach ($shares as $shares)
  &lt;p&gt; {{$shares-&gt;user-&gt;getname()}}&lt;/p&gt; 
  @endforeach
  </code></pre>
  
  <p>My question is, What is the correct syntax to integrate the {{$shares->user->getname()}}  into the @foreach ($friendShares as $friendShare) , which could be something like this :</p>
  
  <pre><code>@foreach ($friendShares as $friendShare , $shares as $shares )
  &lt;p&gt; {{$friendShare-&gt;body}} by {{$shares-&gt;user-&gt;getname()}}}}&lt;/p&gt; 
  </code></pre>