title: Update or create rows database. Laravel
body: <p>I have a little problem with creating a new record in the database. I need to create or update records in the skills table. Request from the user is an array. I use a loop for retrieving data from requests. When I submit the form, the skills array show empty. How can I solve this problem?</p>
  <p>Thanks, Advance</p>
  <pre><code>    $skills = [];
      
     for ($i = 0;$i &lt; count($validated['skills_name']);$i++)
     {
      
            $data = [
                     'name' =&gt; $validated['skills_name'][$i], 
                     'rate' =&gt; $validated['skills_rate'][$i]
                    ];
      
            $skills[] = $data;                  
      }
      
      Skill::updateOrCreate(['profile_key' =&gt; Auth::user()-&gt;profile-&gt;key],$skills);
  </code></pre>