title: Fetch the value of a given column in Eloquent
body: <p>I am trying to get the <strong>value</strong> of a single column using Eloquent:</p>
  
  <pre><code>MyModel::where('field', 'foo')-&gt;get(['id']); // returns [{"id":1}]
  
  MyModel::where('field', 'foo')-&gt;select('id')-&gt;first() // returns {"id":1}
  </code></pre>
  
  <p>However, I am getting anything but the value <code>1</code>. How can get that <code>1</code>?</p>
  
  <p>NOTE: <em>It is possible that the record with <code>field</code> of <code>foo</code> does not exist in the table!</em></p>
  
  <h3>EDIT</h3>
  
  <p>I am ideally looking for a <em>single statement</em> that either returns the value (e.g. <code>1</code>) or fails with a <code>''</code> or <code>null</code> or other. To give you some more context, this is actually used in <code>Validator::make</code> in one of the rules: </p>
  
  <pre><code>'input' =&gt; 'exists:table,some_field,id,' . my_query_above...
  </code></pre>
  
  <h3>EDIT 2</h3>
  
  <p>Using Adiasz's answer, I found that <code>MyModel::where('field', 'foo')-&gt;value('id')</code> does exactly what I need: returns an integer value or an empty string (when failed).</p>