title: How to do a where clause in Laravel
body: <p>I'm trying to build a call to my database with a where clause in Laravel 4.  Sounds simple enough, but I'm getting an error that makes no sense.  This call works:</p>
  
  <pre><code>return MainContact::all();
  </code></pre>
  
  <p>When I view that page, I get a JSON representation of my data, with all of my data, like you'd expect.  It includes this:</p>
  
  <pre><code>... "flag":1 ...
  </code></pre>
  
  <p>So when I try to do this, as explained in the Laravel documentation:</p>
  
  <pre><code>return MainContact::where('flag', '=', '1');
  </code></pre>
  
  <p>you would think it would work, but it doesn't.  I've tried the number as both a string and integer, and neither works.  I get this error:</p>
  
  <pre><code>ErrorException: Catchable Fatal Error: Object of class 
  Illuminate\Database\Eloquent\Builder could not be converted to string in 
  /Users/universal/Sites/universalLaser/leads/vendor/symfony/http-foundation/Symfony/
  Component/HttpFoundation/Response.php line 351
  </code></pre>
  
  <p>Has something changed with where clauses in Laravel 4?  Or am I not understanding how to do them?</p>