title: laravel updateOrCreate method
body: <p>I have the following code in my method which I am sending via ajax to the controller method :</p>
  
  <pre><code>    $newUser = \App\UserInfo::updateOrCreate([
          'user_id'   =&gt; Auth::user()-&gt;id,
          'about'     =&gt; $request-&gt;get('about'),
          'sec_email' =&gt; $request-&gt;get('sec_email'),
          'gender'    =&gt; $request-&gt;get("gender"),
          'country'   =&gt; $request-&gt;get('country'),
          'dob'       =&gt; $request-&gt;get('dob'),
          'address'   =&gt; $request-&gt;get('address'),
          'mobile'    =&gt; $request-&gt;get('cell_no')
      ]);
  </code></pre>
  
  <p>The <code>dd($request-&gt;all())</code> gives me :</p>
  
  <pre><code>array:8 [
    "_token" =&gt; "fHeEPfTvgMD3FpIBmmc6DmKXFaiuWKZEiOhg6twQ"
    "about" =&gt; "Some about me."
    "sec_email" =&gt; "example@gmail.com"
    "country" =&gt; "Priority highest"
    "gender" =&gt; "male"
    "dob" =&gt; "12/12/1990"
    "address" =&gt; "Some address"
    "cell_no" =&gt; "234234234"
  ]
  </code></pre>
  
  <p>which is perfect.</p>
  
  <p>Jquery code :</p>
  
  <pre><code>$('#submit-editProfile-form').on('click', function() {
      var profileEditForm = $("#edit-user-profile");
      var formData = $('#edit-user-profile').serialize();
      profileEditForm.on('submit', function(e){
          e.preventDefault();
          $.ajaxSetup({
              headers: {
                  'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
              }
          });
          $.ajax({
              url:'/freelance/edit-userProfile-info',
              type:'POST',
              data:formData,
              error: function (data) {
                 console.log('Error');
              }
          });
      }).submit();
  });
  </code></pre>
  
  <p><strong>Now the problem is that i have a record in my table, But the above code creates another one, And the second is that it creates multiply by two records on each button click (request).</strong> </p>