title: How can i query build Where IF condition in Laravel
body: <p>i'm build a query in my MySQL editor, but now i want to transform this SQL below in a query builder SQL in Laravel 5, can someone help me? i searched a lot about Where IF condition in Laravel, but not was found.</p>
  
  <pre><code>select *
  from eventos
  where inicio = '2016-09-06 09:41'
  and recorrencia = 0
  or recorrencia = 1 
  and 
  (
      if (recorrencia_tipo = 'semanal', recorrencia_intervalo, 7) LIKE concat('%', weekday('2016-09-06 00:00:00'), '%')
          or
      if(recorrencia_tipo = 'mensal', recorrencia_intervalo, 0) = day('2016-09-06 09:41')
          or
      (
          if (recorrencia_tipo = 'anual', substring_index(recorrencia_intervalo, '/', 1), 0) = DAY('2016-09-06 09:41')
              or 
          if (recorrencia_tipo = 'anual', substring_index(recorrencia_intervalo, '/', -1), 0) = MONTH('2016-09-06 09:41')
      )
  )
  </code></pre>
  
  <p>I builded until this in Laravel</p>
  
  <pre><code>Evento::where('inicio', '2016-09-06 09:41')
              -&gt;where('recorrencia', 0)
              -&gt;orWhere('recorrencia', 1)
              -&gt;where('recorrencia_tipo', function ($query) {
              })-&gt;get();
  </code></pre>