title: Laravel where with if else
body: <p>In my Laravel project I'm building a query with some conditionals.
  There is one issue that I can't get my head around</p>
  <p>I have a Query that goes as follows</p>
  <pre><code>$query = SocialMediaFeed::where('location_id', $location_id);
  </code></pre>
  <p>Now there are some feed items which have 'self' = true.. These should be ignored from the results at first, unless when there is a $filters array.</p>
  <pre><code>if(!$filters) {
      $query = $query-&gt;where('self', '&lt;&gt;', true);
  }
  </code></pre>
  <h2>Now I'm wondering, If there are filters, it should include the data that I got when self not equal to true, but also the data if it is true..</h2>
  <p>I tried the following, <strong>But that only returns the self=true posts, instead of all posts combined with self=true</strong></p>
  <pre><code>$query = $query
      -&gt;where('self', '&lt;&gt;', true)
      -&gt;where('self', true)
      -&gt;orWhereNull('self');
  </code></pre>