title: Undefined variable in fluent query builder
body: <p>I am starting to use the Laravel framework, and I have a problem with the fluent query builder. In a where condition, if I am using raw values or <code>Input::get()</code>, it retrieves the results and executes correctly, but when I use an assigned variable it shows "Undefined variable" errors.</p>
  
  <pre><code>$properties = Listing::where(function($query)
  {
      if (Input::has('property-type')) $query-&gt;where('property_type', '=',Input::get('property-type'));
  })-&gt;get();
  </code></pre>
  
  <p>it  works correctly, but if I do</p>
  
  <pre><code>$pt=Input::get('property-type');
  $properties = Listing::where(function($query)
  {
      if ($pt!='') $query-&gt;where('property_type', '=',$pt);
  })-&gt;get();
  </code></pre>
  
  <p>it returns the error</p>
  
  <pre><code>Undefined variable: pt
  </code></pre>
  
  <p>If I print the variable "$pt" it contains the value.</p>
  
  <p>I want to use only the variable values, because I should pass these value from the controller to the model as parameters, and build the query in the model function. Am I doing something wrong? Is the variable not assigned before the query execution? Please, can anyone help me to resolve this?</p>