title: How can I build a condition based query in Laravel?
body: <p>I can do this in Code Igniter:</p>
  
  <pre><code>$this-&gt;db-&gt;select();
  $this-&gt;from-&gt;('node');
  if ($published == true)
  {
      $this-&gt;db-&gt;where('published', 'true');
  }
  if (isset($year))
  {
      $this-&gt;db-&gt;where('year &gt;', $year);
  }
  $this-&gt;db-&gt;get();
  </code></pre>
  
  <p>How can this code be translated so that it works in Laravel?</p>