title: How to pass parameters with Inertia to Laravel controller?
body: <p>I'm working on a small scale project, let's call it a playground for testing purposes.</p>
  <p>I have some data:</p>
  <pre><code>  data() {
      return {
        form: this.$inertia.form({
          id: &quot;&quot;,
          name: &quot;&quot;,
          email: &quot;&quot;,
          files: &quot;&quot;,
        }),
       };
      }
  </code></pre>
  <p>A form handles the request through a function call on submit:</p>
  <pre><code>      this.form
          .transform((data) =&gt; ({
            ...data,
            name: this.sample.name,
            email: this.sample.email,
            files: this.sample.files,
          }))
          .patch(
            this.route(&quot;cms.products.sample.update&quot;, {
              sample: this.sample,
            }),
            {
              forceFormData: true,
              onSuccess: () =&gt; {
                this.form.reset();
              },
            }
          );
  </code></pre>
  <p>The sample object that is passed refers to the object that needs to be updated. He is passed correctly and Laravel's dd($sample); reads it properly.</p>
  <p>The problem lies in the form data that it is passed. Data is not passed to the $request-&gt;all(), that is to the attributes of the request. Rather it is passed to the content part and it is parsed in a very weird way, like this:</p>
  <pre><code>#content: &quot;&quot;&quot;
      ------WebKitFormBoundaryvh1XjftW9MtXqoUC
      Content-Disposition: form-data; name=&quot;id&quot;
      
      
      ------WebKitFormBoundaryvh1XjftW9MtXqoUC
      Content-Disposition: form-data; name=&quot;name&quot;
      
      Sample Name
      
  </code></pre>
  <p>Without passing custom sample data the form data is correctly passed to the $request-&gt;all(), but then an error occurs requiring a model to be passed on update</p>
  <p>Laravels Controller looks like this:</p>
  <pre><code>    public function update(UpdateSampleRequest $request, Sample $sample)
      {
          dd($request, $sample);
      }
  </code></pre>
  <p>Route is registered in web.php:</p>
  <pre><code> PUT|PATCH admin/products/sample/{sample}.......... cms.products.sample.update › SampleController@update
  </code></pre>