title: MethodNotAllowedHttpException in RouteCollection.php line 207 Laravel
body: <p>I am new with laravel and I have a problem and I can not solve it. I have already seen the official documentation as well as some other questions right here but I can not solve it.</p>
  
  <p>What I want to achieve is an update to the database, but as I'm not successful I'm simply trying to send a response with some message that I can not get it to work either.
  I am trying it through ajax, I want to send information to the controller and there the update is performed, in this case it responds a simple message ...</p>
  
  <p>This is my route:</p>
  
  <pre><code>Route::patch('pdv/inventario-transferencia/{store}/{idTran}/update', 'InventoryController@editQtTemp');
  </code></pre>
  
  <p>This is my code that is executed by pressing a button:</p>
  
  <pre><code>$('.btn-qtyTemp').click(function(e) {
      //ADAN
      e.preventDefault();
      id_el = $(this).data('id');
      valInput = document.getElementById('input-'+id_el).value;      
      el = id_el.replace("quantityTemp-", "");
      var  valueIdTran = parseInt(el);
      if(!isNaN(valueIdTran)) {
  
           $.ajaxSetup({
              headers: {
                  'X-XSRF-Token': $('meta[name="_token"]').attr('content')
              }
          });
  
          $.ajax({
              type: 'patch',
              url: location.pathname + '/' + el + '/update',
              dataType: 'json',
              data: {
                  isValInput: valInput
              },
              beforeSend: function () {
                  console.log('entrando');
              },
              success: function (data) {
                  console.log('Todo Correcto'+data.isId);
              },
              error: function (data) {
                  console.log('Algo anda mal'+data.isId);
              }
          });
      }
      //      alert('id_el: '+id_el+' el: '+el+' value: '+valueIdTran+' val: '+valInput);
  });  
  </code></pre>
  
  <p>And this is the function of the controller:</p>
  
  <pre><code>public function editQtTemp(Request $request, $store, $idTran) {
  
  
         if ($request-&gt;ajax()) {
  
              $this-&gt;validate($request, [
                  'isValInput' =&gt; 'required'
              ]);
  
              //
              $isValInput = $request-&gt;input('isValInput');
  
              if ($isValInput=='') {
                  # code...
                  return response()-&gt;json([
                      'isId' =&gt; ['Valor Invalido']
                  ], 422);
              }
              else {
                  return response()-&gt;json([
                      'isId' =&gt; [$isValInput]
                  ], 200);
              }
          }
  }
  </code></pre>
  
  <p>The error that appears to me is the following:</p>
  
  <pre><code>MethodNotAllowedHttpException in RouteCollection.php line 207:
  
  
      in RouteCollection.php line 207
      at RouteCollection-&gt;methodNotAllowed(array('POST')) in RouteCollection.php line 194
      at RouteCollection-&gt;getRouteForMethods(object(Request), array('POST')) in RouteCollection.php line 142
      at RouteCollection-&gt;match(object(Request)) in Router.php line 729
      at Router-&gt;findRoute(object(Request)) in Router.php line 652
      at Router-&gt;dispatchToRoute(object(Request)) in Router.php line 628
      at Router-&gt;dispatch(object(Request)) in Kernel.php line 214
      at Kernel-&gt;Illuminate\Foundation\Http\{closure}(object(Request))
      at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
      at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 43
      at VerifyCsrfToken-&gt;handle(object(Request), object(Closure)) in VerifyCsrfToken.php line 36
      at VerifyCsrfToken-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 125
      at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 55
      at ShareErrorsFromSession-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 125
      at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 61
      at StartSession-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 125
      at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 36
      at AddQueuedCookiesToResponse-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 125
      at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 40
      at EncryptCookies-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 125
      at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
      at CheckForMaintenanceMode-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 125
      at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
      at call_user_func(object(Closure), object(Request)) in Pipeline.php line 100
      at Pipeline-&gt;then(object(Closure)) in Kernel.php line 115
      at Kernel-&gt;sendRequestThroughRouter(object(Request)) in Kernel.php line 84
      at Kernel-&gt;handle(object(Request)) in index.php line 52
  </code></pre>
  
  <p>I have no idea what may be happening, I have done this in pure PHP but with laravel I am having many problems ... Thanks</p>