title: Update/Insert parent with child based on validation rules Laravel
body: <p>I want to update/insert my parent directly with my child instead of separated them. After my validation rule has passed.</p>
  <p>my code:</p>
  <pre><code>$validatedData = $request-&gt;validate([
      'id' =&gt; 'bail|integer',
      'code' =&gt; 'bail|integer',
      'name' =&gt; 'bail|required|string|max:255',
      'child' =&gt; 'bail|array',
      'child.something' =&gt; 'bail|integer',
  ]);
  
  $parent = Parent::updateOrCreate(['id' =&gt; $request-&gt;id, 'code' =&gt; $request-&gt;code], $validatedData);
  </code></pre>