title: Laravel Model with Two Primary Keys update
body: <p>I'm trying to update Model which has two primary keys.</p>
  
  <p>Model
      
  
  <pre><code>namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Inventory extends Model
  {
      /**
       * The table associated with the model.
       */
      protected $table = 'inventories';
  
      /**
       * Indicates model primary keys.
       */
      protected $primaryKey = ['user_id', 'stock_id'];
  ...
  </code></pre>
  
  <p>Migration</p>
  
  <pre><code>Schema::create('inventories', function (Blueprint $table) {
      $table-&gt;integer('user_id')-&gt;unsigned();
      $table-&gt;integer('stock_id')-&gt;unsigned();
      $table-&gt;bigInteger('quantity');
  
      $table-&gt;primary(['user_id', 'stock_id']);
  
      $table-&gt;foreign('user_id')-&gt;references('id')-&gt;on('users')
          -&gt;onUpdate('restrict')
          -&gt;onDelete('cascade');
      $table-&gt;foreign('stock_id')-&gt;references('id')-&gt;on('stocks')
          -&gt;onUpdate('restrict')
          -&gt;onDelete('cascade');
  });
  </code></pre>
  
  <p>This is code which should update Inventory model, but it doesn't.</p>
  
  <pre><code>$inventory = Inventory::where('user_id', $user-&gt;id)-&gt;where('stock_id', $order-&gt;stock-&gt;id)-&gt;first();
  $inventory-&gt;quantity += $order-&gt;quantity;
  $inventory-&gt;save();
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Illegal offset type
  </code></pre>
  
  <p>I also tried to use updateOrCreate() method. It doesn't work (I get same error).</p>
  
  <p>Can anyone tell how Model with two primary key should be updated? </p>