title: Laravel 4/PHP: Dynamic where clauses if a variable is not null
body: <p>Is there a way to create a dynamic sql query so that certain where clauses only run if a variable isn't null? </p>
  
  <p>So say a user can select various options to filter results and they can chose not to select a an option from certain dropdowns if they don't need to. That would result in certain variables being null. </p>
  
  <p>I'd like to do it in a way that wouldn't result in writing if statements to cater for every eventuality. </p>
  
  <p>Don't mind suggestions in PHP or Laravel specific answers.</p>
  
  <p>Thanks!</p>