title: Laravel eloquent query running twice
body: <p>I'm scraping some data from Instagram and then creating a record of it in the database, but sometimes, the record will be inserted twice (or more). When I add an <code>echo</code> in the code it only prints/echos once, so I'm not sure why sometimes the records insert multiple times. Here's the code:</p>
  
  <pre class="lang-php prettyprint-override"><code>public function handle()
  {
  
      #Define variables
      $website_id = null;
      $user_id = null;
      $avg_dataset_start = null;
      $avg_dataset_end = null;
  
      try {
          $api = new \Instagram\Api();
          $api-&gt;setUserName($this-&gt;username);
          $obj = $api-&gt;getFeed();
  
          #quick hack to convert to nested obj
          $data = json_decode(json_encode($obj));
  
          $data-&gt;videos_count = 0;
          $data-&gt;pictures_count = 0;
          $data-&gt;avgPostLikes = 0;
          $data-&gt;avgPostComments = 0;
      } catch (Exception $e) {
          return $e;
      }
  
      $account = InstagramAccount::where('instagram_id', $data-&gt;id)-&gt;orWhere('username', $data-&gt;userName)-&gt;first();
  
          $scraped_data = InstagramAccountScrape::create([
              'instagram_account_id' =&gt; $account-&gt;id,
              'username' =&gt; $data-&gt;userName,
              'full_name' =&gt; $data-&gt;fullName,
              'biography' =&gt; $data-&gt;biography,
              'profile_picture_url' =&gt; $data-&gt;profilePicture,
              'external_url' =&gt; $data-&gt;externalUrl,
              'website_id' =&gt; $website_id,
              'media_count' =&gt; $data-&gt;mediaCount,
              'followers_count' =&gt; $data-&gt;followers,
              'following_count' =&gt; $data-&gt;following,
              'avg_likes_count' =&gt; $data-&gt;avgPostLikes,
              'avg_comments_count' =&gt; $data-&gt;avgPostComments,
              'avg_dataset_start' =&gt; $avg_dataset_start,
              'avg_dataset_end' =&gt; $avg_dataset_end,
              'avg_dataset_photos_count' =&gt; $data-&gt;pictures_count,
              'avg_dataset_videos_count' =&gt; $data-&gt;videos_count,
              'is_private' =&gt; $data-&gt;private,
              'is_verified' =&gt; $data-&gt;verified,
              'user_id' =&gt; $user_id,
          ]); #Sometimes adds more than one record
  
      echo "Print once please"; #prints once, as expected
  
      return response()-&gt;json($scraped_data); #returns only one instance
  }
  </code></pre>