title: Laravel 5.1 deleting duplicates in DB with eloquent
body: <p>I am wondering how to delete duplicate entries in the DB table, and keeping the new copies in the table. This is how my table looks like:</p>
  
  <pre><code> $table-&gt;increments('id');
   $table-&gt;string('text');
   $table-&gt;string('type');
   $table-&gt;integer('external_id');
   $table-&gt;timestamps();
  </code></pre>
  
  <p>Since I am importing from other DB, and I would like to import all data once a day, means there will be some existing entries already in DB, and new entries as well. 
  Since I need to keep only the entries that are new, I need to delete all old entries (duplicates and unique entries that are not new).
  Is there a way to do it with Eloquent in Laravel 5.1?
  I have tried this, but it is deleting everything in the table:</p>
  
  <pre><code>$deleteDuplicates = DB::table('questions')-&gt;select('external_id')-&gt;distinct()-&gt;delete();
  </code></pre>