title: Laravel form best practice ? Hidden input OR Route parameter?
body: <p>I am wondering what is the best practive between sending data through route parameters or hidden inputs in Laravel, or in general. For example, what is the best way in your opinion between :</p>
  
  <p>Route path parameters</p>
  
  <pre><code>/*** Html form --&gt; User and Account ID are sent as route parameters ***/
  
  &lt;form method="post" action="/associate/user/10/account/34"&gt;
      {{ csrf_field() }}
      &lt;input type="submit" /&gt;
  &lt;/form&gt;
  
  /*** Route ***/
  
  Route::post('/associate/user/{user_id}/account/{account_id}', 'UserController@associate');
  
  /*** Controller ***/
  
  public function associate($user_id, $account_id) {
  
      $user = App\User::find($user_id);
  
      $account = App\Account::find($account_id);
  
      $user-&gt;account()-&gt;associate($account);
  
      $user-&gt;save();
  
      return back();
  }
  </code></pre>
  
  <p>OR</p>
  
  <p>Form hidden inputs</p>
  
  <pre><code>/*** Html form --&gt; User and Account ID are sent as hidden inputs ***/
  
  &lt;form method="post" action="/associate/user-account"&gt;
      {{ csrf_field() }}
      &lt;input type="hidden" name="user_id" value="10" /&gt;
      &lt;input type="hidden" name="account_id" value="34" /&gt;
      &lt;input type="submit" /&gt;
  &lt;/form&gt;
  
  /*** Route ***/
  
  Route::post('/associate/user-account', 'UserController@associate');
  
  /*** Controller ***/
  
  public function associate(Request $request) {
  
      $user = App\User::find($request-&gt;input('user_id'));
  
      $account = App\Account::find($request-&gt;input('account_id'));
  
      $user-&gt;account()-&gt;associate($account);
  
      $user-&gt;save();
  
      return back();
  }
  </code></pre>
  
  <p>What do you think ?</p>
  
  <p>Thanks a lot for your opinion.</p>