Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Scottly's avatar

MethodNotAllowedHttpException

This is doing my head in. I'm getting this error when trying to update something from a form:

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No Message

The form itself:

  <form class="" action="/variants/{{$variant->id}}" method="PATCH">
{{ csrf_field() }}
<input id="variantInputname" type="text" name="name" value="{{$variant->name}}">

<input id="variantInputrole" type="text" name="role" value="{{$variant->role}}">
<button type="submit">Save changes</button>
</form>

The route:

Route::patch('/variants/{variant}', 'VariantController@update');

The update method in VariantController.php (although I don't think I'm getting this far):

public function update(Request $request, $id)
    {
      //dd('$id');

      $variant = Variant::findOrFail($id);

      $variant->update($request->all());

      return redirect('/variants');
}

The weird thing is that the error gives a load of information about the GET request I'm sending...but this is a PATCH, not a GET?

0 likes
1 reply

Please or to participate in this conversation.