MethodNotAllowedHttpException in RouteCollection.php line 219
Check your form tag
<form action="/path/" method="post">
in here "/path/" should be "/path" , do not use "/" at the end.
Since you're setting the method on the post's update to be patch
, be sure you open your form to use that method:
{!! Form::open(['method' => 'patch']) !!}
If you're not using the Form
class, you can also just ensure there's a hidden element called _method
underneath the form:
<input name="_method" type="hidden" value="PATCH">
Similarly, if you're sending this data via AJAX, just add a _method
key to the payload set to 'PATCH'
before sending the request via POST. Some browsers (IE 7/8) do not support PATCH HTTP through XMLHttpRequest
Your other option is to change your route to accept POST data instead:
Route::post('posts/store-new-post', 'PostsController@store');
Route::post('posts/{slug}', 'PostsController@update');