title: Laravel. Get single column values of a table using Query Builder
body: <p>I have a table named "items" and an input for the where condition named "ref_code". </p>
  
  <pre><code>$items = DB::table('items')
               -&gt;where('ref_code','=', $request-&gt;ref_code)
               -&gt;get(['id', 'ref_code', 'name','price']);
  </code></pre>
  
  <p>But I can't seem to take the values of each column.</p>
  
  <p>I checked wether the query builder worked or not by using:</p>
  
  <pre><code>return $items;
  </code></pre>
  
  <p>Fortunately, there's no problem.</p>
  
  <p>But returning or getting a single value doesn't work with:</p>
  
  <pre><code>return $items-&gt;id
  </code></pre>
  
  <p>Is my syntax wrong? All of this are inside my controller.</p>
  
  <p>EDIT: I tried</p>
  
  <pre><code>dd($items);
  </code></pre>
  
  <p>before returning and it showed me this:</p>
  
  <pre><code>  Collection {#325 ▼
    #items: array:1 [▼
      0 =&gt; {#322 ▶}
    ]
  }
  </code></pre>