@scottly You can only submit a GET or POST request from a Laravel form. Look over the docs. https://laravel.com/docs/5.5/routing#form-method-spoofing
You need to use {{ method_field('PATCH') }} to submit another type of action.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
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?
@scottly You can only submit a GET or POST request from a Laravel form. Look over the docs. https://laravel.com/docs/5.5/routing#form-method-spoofing
You need to use {{ method_field('PATCH') }} to submit another type of action.
Please or to participate in this conversation.