title: Return Response()->Json and Arrays in Laravel
body: <p>I have a controller that I would like to return a JSON response that has multiple arrays. First, I'll present my controller:</p>
  
  <pre><code>&lt;?php
  
  public function notificationEmails(Request $request)
  {
      $shipment = Shipment::findOrFail($request-&gt;shipmentID);
      $billToAccount =   $shipment-&gt;billtoAccount;
      $billToAccountUsers = $billToAccount-&gt;users;
  
      foreach ($billToAccountUsers as $billToAccountUser){
          $billToEmail = $billToAccountUser-&gt;email;
      }                   
  
      $shipToAccount =   $shipment-&gt;shiptoAccount;
      $shipToAccountUsers = $shipToAccount-&gt;users;
  
      foreach ($shipToAccountUsers as $shipToAccountUser){
          $shipToEmail = $shipToAccountUser-&gt;email;
      }
  
      $shipFromAccount =   $shipment-&gt;shipfromAccount;
      $shipFromAccountUsers = $shipFromAccount-&gt;users;     
  
      foreach ($shipFromAccountUsers as $shipFromAccountUser){
          $shipFromEmail = $shipFromAccountUser-&gt;email;
      }
  
      return response()-&gt;json([
                      'details' =&gt; $shipment,
                      'billersEmails' =&gt; $billToEmail
                  ]);
  }
  </code></pre>
  
  <p>This is an example, but at this time if I just dd($billToEmail), I will get multiple rows returned of all of the data that I requested (all of which are emails), but when I return the JSON specific return "billersEmails", I only get one of those emails returned. </p>
  
  <p>I know there must be a possibility of the multiple emails being returned, but I haven't found an appropriate response anywhere as of yet. </p>