title: ON DUPLICATE KEY UPDATE in Eloquent
body: <p>I just started laravel and all I want to do is get <strong>following query</strong> working <strong>in Eloquent</strong>:<br></p>
  
  <pre><code>INSERT INTO geschichte (geschichte_id, 
                          geschichte_text1, 
                          geschichte_text2, 
                          geschichte_text3) 
  VALUES (:geschichte_id, 
          :geschichte_text1, 
          :geschichte_text2, 
          :geschichte_text3) 
  ON DUPLICATE KEY 
  UPDATE geschichte_id = :geschichte_id, 
         geschichte_text1 = :geschichte_text1, 
         geschichte_text2 = :geschichte_text2, 
         geschichte_text3 = :geschichte_text3;
  </code></pre>
  
  <p><strong>Controller function</strong></p>
  
  <pre><code>public function alterGeschichte(Request $request)
  {
      $geschichte1 = new Geschichte;
      $geschichte2 = new Geschichte;
      $geschichte3 = new Geschichte;
  
      $geschichte1 = Geschichte::updateOrCreate(
         ['id' =&gt; 1],
         ['geschichte_text1' =&gt; $request-&gt;geschichte_text1]
      );
      $geschichte2 = Geschichte::updateOrCreate(
         ['id' =&gt; 2],
         ['geschichte_text2' =&gt; $request-&gt;geschichte_text2]
      );
      $geschichte3 = Geschichte::updateOrCreate(
         ['id' =&gt; 3],
         ['geschichte_text3' =&gt; $request-&gt;geschichte_text3]
      );
  
      $geschichte1-&gt;save();
      $geschichte2-&gt;save();
      $geschichte3-&gt;save();
  
      return redirect('/geschichte');
  }
  </code></pre>
  
  <p><strong>The problem in more detail</strong><br><br>
  I cannot get the 'on duplicate key update' part to work.<br> 
  There always is a new entry created for every time I update. I would like the id always to be the same for every entry and just overwrite the older entry with that id.<br><br>
  I would be very thankful for any kind of help. I am struggling with this from hours...
  <br><br>
  <strong>UPDATE</strong></p>
  
  <pre><code>&lt;?php
  
  use Illuminate\Database\Schema\Blueprint;
  use Illuminate\Database\Migrations\Migration;
  
  class CreateGeschichteTable extends Migration
  {
      /**
       * Run the migrations.
       *
       * @return void
       */
      public function up()
      {
          Schema::create('geschichte', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;text('geschichte_text1');
              $table-&gt;text('geschichte_text2');
              $table-&gt;text('geschichte_text3');
              $table-&gt;timestamps();
          });
      }
  
      /**
       * Reverse the migrations.
       *
       * @return void
       */
      public function down()
      {
          Schema::drop('geschichte');
      }
  }
  </code></pre>