title: How to extract all rows which is duplicates in laravel?
body: <p>I want to get all rows which is the same name and location from <strong>Users Table</strong></p>
  
  <pre><code>**id** |name        |location    |phone_number
  
  1      |John        | Europe     |0988884434
  
  2      |john        | Europe        |0933333333
  
  3      |Michael     |Europe      |0888888888
  
  4      |Smith       |Dubai       |082388888888
  
  5      |Smith       |Dubai      | 03939494944
  </code></pre>
  
  <p>I want to get <strong>all rows</strong> which is the same name and location like </p>
  
  <pre><code>john  |Europe
  
  john  |Europe
  
  Smith |Dubai
  
  Smith |Dubai
  </code></pre>
  
  <p>here is how i tried to do </p>
  
  <pre><code>$duplicates = DB::table('users')
  -&gt;select('name','location', DB::raw('COUNT(*) as `count`'))
  -&gt;groupBy('name', 'location')
  -&gt;having('count', '&gt;', 1)
  -&gt;get();
  </code></pre>
  
  <p>but this is just showing only one row which is duplicates like</p>
  
  <pre><code>john |Europe
  Smith|Dubai
  </code></pre>
  
  <p>Any help or advice you have would be greatly appreciated.</p>