title: Queries in Laravel Logic operators
body: <p>I want to query Laravel DB for something like</p>
  
  <pre><code>SELECT * FROM `tickets` 
  WHERE (created_at &gt; '2015-07-01'
      AND created_at &lt; '2015-07-31')
  AND (state != 'Resolved'
      OR state != 'closed'
      OR state != 'Cancelled'
      OR state != 'Solution Rejected')
  ORDER BY `id` DESC 
  </code></pre>
  
  <p>I tried using raw statements but doesn't seem to work. So I'm trying to use Laravel's own model functions to archive the same result, but I'm missing something... here's what I got so far.</p>
  
  <pre><code>Ticket::whereBetween('created_at', [$start, $end])
  -&gt;whereIn('state',['Resolved','closed','Cancelled','Solution Rejected'])
  -&gt;get();
  </code></pre>
  
  <p>PS: alternatively is there a way I can have this instead</p>
  
  <pre><code>SELECT * FROM `tickets` 
  WHERE ( (created_at &gt; '2015-07-01'
      AND created_at &lt; '2015-07-31')
      OR (updated_at &gt; '2015-07-01'
      AND updated_at &lt; '2015-07-31') )
  AND (state != 'Resolved'
      OR state != 'closed'
      OR state != 'Cancelled'
      OR state != 'Solution Rejected')
  ORDER BY `id` DESC 
  </code></pre>