title: Laravel Collection() vs collect()
body: <p>I have a series of database tables that store estimating information. I am trying to return all data from all database tables when certain perimeters are set.</p>
  
  <p>Collection</p>
  
  <pre><code>        $estimateItems = new Collection();
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getBoxVent() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getCoatings() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getCounterFlashing() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getDripEdge() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getFasteners() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getHeadwallFlashing() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getHipcap() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getIceShield() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getPipeFlashing() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getRidgecap() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getRidgeVentilation() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getSheathing() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getShingles() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getSidewallFlashing() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getSkylights() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getStarterShingle() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getTearOff() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getUnderlayment() );
      $estimateItems = $estimateItems-&gt;merge( $this-&gt;getValleyMetal() );
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/RVkXb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RVkXb.png" alt="enter image description here"></a></p>
  
  <p>and Collect()</p>
  
  <pre><code>$collectedItems = collect([
          $this-&gt;getBoxVent(),
          $this-&gt;getCoatings(),
          $this-&gt;getCounterFlashing(),
          $this-&gt;getDripEdge(),
          $this-&gt;getFasteners(),
          $this-&gt;getHeadwallFlashing(),
          $this-&gt;getHipcap(),
          $this-&gt;getIceShield(),
          $this-&gt;getPipeFlashing(),
          $this-&gt;getRidgecap(),
          $this-&gt;getRidgeVentilation(),
          $this-&gt;getSheathing(),
          $this-&gt;getShingles(),
          $this-&gt;getSidewallFlashing(),
          $this-&gt;getSkylights(),
          $this-&gt;getStarterShingle(),
          $this-&gt;getTearOff(),
          $this-&gt;getUnderlayment(),
          $this-&gt;getValleyMetal(),
      ]);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/NBs6f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NBs6f.png" alt="enter image description here"></a></p>
  
  <p>There are only 4 database tables that have data pertaining to this "estimate" for this example. Ideally there would be 1 or all have data.</p>
  
  <p>Why does Collection only return a maximum of 3, where as collect returns them all even if they're empty?</p>
  
  <p>Am i doing something wrong to have the <code>$estimateItems = new Collection();</code> only return 3, when theres 4 or more in database?</p>
  
  <p>Here are the queries I am using.</p>
  
  <pre><code>    private function getBoxVent() {
      return ProposalBoxVent::where('proposalRecordID', $this-&gt;getProposalAPI())-&gt;get();
  }
  
  private function getCoatings() {
      return ProposalCoatings::where('proposalRecordID', $this-&gt;getProposalAPI())-&gt;get();
  }
  </code></pre>
  
  <p>If I use <code>concat</code> instead of <code>merge</code> I get the desired results.
  <a href="https://i.stack.imgur.com/sL5B5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sL5B5.png" alt="enter image description here"></a></p>