title: Update 2 tables with 1 form in laravel
body: <p>I have <code>users</code> table and <code>profiles</code> table, now i want let users to update their info in single form.</p>
  
  <h1>Logic</h1>
  
  <ol>
  <li>name &amp; email will update in users table</li>
  <li>rest of the fields will update in profiles table</li>
  </ol>
  
  <h1>Code</h1>
  
  <p><code>blade</code> (form)</p>
  
  <pre><code>{{ Form::model($user, array('route' =&gt; array('profileupdate', $user-&gt;id), 'method' =&gt; 'PUT','files' =&gt; true)) }}
                  &lt;div class="row"&gt;
                      &lt;div class="col-md-6"&gt;
                          &lt;label for="name"&gt;Name&lt;/label&gt;
                          {{Form::text('name', null, array('class' =&gt; 'search-field'))}}
                      &lt;/div&gt;
                      &lt;div class="col-md-6"&gt;
                          &lt;label for="email"&gt;Email&lt;/label&gt;
                          {{Form::text('email', null, array('class' =&gt; 'search-field'))}}
                      &lt;/div&gt;
                      &lt;div class="col-md-6 mt-3"&gt;
                          &lt;label for="about"&gt;About&lt;/label&gt;
                          {{Form::textarea('about', null, array('class' =&gt; 'search-field'))}}
                      &lt;/div&gt;
                      &lt;div class="col-md-6 mt-3"&gt;
                          &lt;div class="row"&gt;
                              &lt;div class="col-md-6"&gt;
                                  &lt;label for="phone"&gt;Phone&lt;/label&gt;
                                  {{Form::text('phone', null, array('class' =&gt; 'search-field'))}}
                              &lt;/div&gt;
                              &lt;div class="col-md-6"&gt;
                                  &lt;label for="website"&gt;Website&lt;/label&gt;
                                  {{Form::text('website', null, array('class' =&gt; 'search-field'))}}
                              &lt;/div&gt;
                              &lt;div class="col-md-6 mt-3"&gt;
                                  &lt;label for="state"&gt;State&lt;/label&gt;
                                  {{Form::text('state', null, array('class' =&gt; 'search-field'))}}
                              &lt;/div&gt;
                              &lt;div class="col-md-6 mt-3"&gt;
                                  &lt;label for="city"&gt;City&lt;/label&gt;
                                  {{Form::text('city', null, array('class' =&gt; 'search-field'))}}
                              &lt;/div&gt;
                              &lt;div class="col-md-12 mt-3"&gt;
                                  &lt;label for="photo"&gt;Photo&lt;/label&gt;
                                  {{Form::file('photo', array('class' =&gt; 'search-field'))}}
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;div class="col-md-12"&gt;
                          {{ Form::submit('Update', array('class' =&gt; 'btn btn-success mt-5')) }}
                      &lt;/div&gt;
                  &lt;/div&gt;
  
  {{Form::close()}}
  </code></pre>
  
  <h1>Screenshot (code above)</h1>
  
  <p><a href="https://i.stack.imgur.com/c0vRV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c0vRV.png" alt="one"></a></p>
  
  <p><code>controller</code></p>
  
  <pre><code>public function update(Request $request, $id)
  {
          $user = User::find($id);
          $user = User::where('id',$id)-&gt;first();
          $user-&gt;name = $request-&gt;input('name');
          $user-&gt;save();
  
          $profile = Profile::find($id);
          $profile = Profile::where('id',$id)-&gt;first();
          $profile-&gt;user_id = $request-&gt;input('user_id');
          $profile-&gt;about = $request-&gt;input('about');
          $profile-&gt;website = $request-&gt;input('website');
          $profile-&gt;phone = $request-&gt;input('phone');
          $profile-&gt;state = $request-&gt;input('state');
          $profile-&gt;city = $request-&gt;input('city');
  
          if ($request-&gt;hasFile('photo')) {
              $photo = $request-&gt;file('photo');
              $filename = 'photo' . '-' . time() . '.' . $photo-&gt;getClientOriginalExtension();
              $location = public_path('images/' . $filename);
              Image::make($photo)-&gt;resize(1300, 362)-&gt;save($location);
              $profile-&gt;photo = $filename;
  
              $oldFilename = $profile-&gt;photo;
              $profile-&gt;photo = $filename;
              Storage::delete($oldFilename);
          }
  
          $profile-&gt;save();
          return redirect()-&gt;route('profile', $user-&gt;id)-&gt;with('success', 'Your info are updated');
  }
  </code></pre>
  
  <blockquote>
    <p><strong>PS: please don't go with my controller method, I just put data that
    way so you can know what field belongs to what table.</strong></p>
  </blockquote>
  
  <h1>Question</h1>
  
  <p>Any idea how i can save my data in 2 tables at the same time?</p>
  
  <p>And I get this Error</p>
  
  <blockquote>
    <p>Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message</p>
  </blockquote>