title: laravel 8 call to undefined method upsert
body: <p>I just upgraded laravel to v8, I am trying to run the upsert function documented <a href="https://laravel.com/docs/8.x/queries" rel="nofollow noreferrer">here</a> on a seeder.</p>
  <p>Here is a code sample of what I am running</p>
  <pre class="lang-php prettyprint-override"><code>namespace Database\Seeders;
  
  use Illuminate\Database\Seeder;
  use Illuminate\Support\Facades\DB;
  
  class NewspaperSeeder extends Seeder
  {
      /**
       * Run the database seeders.
       *
       * @return void
       */
      public function run()
      {
          DB::table(&quot;newspapers&quot;)-&gt;upsert(
                         [&quot;rows to insert&quot;], 
                         [&quot;primary key&quot;], 
                         [&quot;attributes to update if duplicate&quot;]);
      }
  }
  </code></pre>
  <p>Meanwhile, I end up getting this error when I run <code>php artisan db:seed</code></p>
  <pre><code> BadMethodCallException
  
    Call to undefined method Illuminate\Database\Query\Builder::upsert()
  
    at vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:50
       46▕      * @throws \BadMethodCallException
       47▕      */
       48▕     protected static function throwBadMethodCallException($method)
       49▕     {
    ➜  50▕         throw new BadMethodCallException(sprintf(
       51▕             'Call to undefined method %s::%s()', static::class, $method
       52▕         ));
       53▕     }
       54▕ }
  
    • Bad Method Call: Did you mean Illuminate\Database\Query\Builder::insert() ?
  </code></pre>
  <h3>Edit (composer.json):</h3>
  <p>I followed Upgrading Guide on the official documentation, run <code>composer update</code></p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;require&quot;: {
          &quot;php&quot;: &quot;^7.2.5&quot;,
          &quot;ext-json&quot;: &quot;^7.4&quot;,
          &quot;doctrine/dbal&quot;: &quot;^2.10&quot;,
          &quot;fideloper/proxy&quot;: &quot;^4.0&quot;,
          &quot;fruitcake/laravel-cors&quot;: &quot;^2.0&quot;,
          &quot;guzzlehttp/guzzle&quot;: &quot;^6.3&quot;,
          &quot;laravel/framework&quot;: &quot;^8.0&quot;,
          &quot;laravel/legacy-factories&quot;: &quot;^1.0&quot;,
          &quot;laravel/passport&quot;: &quot;^10.0&quot;,
          &quot;laravel/socialite&quot;: &quot;^5.0&quot;,
          &quot;laravel/tinker&quot;: &quot;^2.0&quot;,
          &quot;laravel/ui&quot;: &quot;^3.0&quot;
      },
      &quot;require-dev&quot;: {
          &quot;beyondcode/laravel-dump-server&quot;: &quot;^1.0&quot;,
          &quot;facade/ignition&quot;: &quot;^2.3.6&quot;,
          &quot;filp/whoops&quot;: &quot;^2.0&quot;,
          &quot;fzaninotto/faker&quot;: &quot;^1.4&quot;,
          &quot;mockery/mockery&quot;: &quot;^1.0&quot;,
          &quot;nunomaduro/collision&quot;: &quot;^5.0&quot;,
          &quot;phpunit/phpunit&quot;: &quot;^9.0&quot;
      },
  }
  
  </code></pre>