Laravel Error Message MethodNotAllowedHttp Submit Update Form

This article is an article written to explain an error happened as stated in the title of this article. The error which is happened in a web-based application powered by Laravel is an error with the message of MethodNotAllowedHttp. The error message happened when a form is being submitted and the form itself is actually a form which is sending the content of the form. The content of the form consists of several and various input type where there are several data which is automatically passed from the view blade file template to a controller.

Below is the image displaying the error message stated in the title of the article :

Basically, there is something wrong in the route definition which the conclusion itself is retrieved from the above image. The following snippet code is taken from the route definition file or route configuration file named ‘web.php’ which in Laravel 5.3 is located in the folder or routes/. The file location is shown in the tree format displayed in the following using the command execution of ‘tree’ :

Below is the route definition taken from the file named web.php located in the ‘routes’ folder :

Route::get('/user/update/{id_user}','UserController@update');

One thing which is considered wrong in the route definition when a submit is being posted is in the method defined to execute the URL and the method processed it. The above route definition is using ‘get’ method, while the form definition used to submit a form is ‘post’. Below is the form definition which is located in a file named ‘edit.blade.php’ :

The above form is a form used to edit user and it is actually taken just a part of the form. When there is a form as shown above with the main purpose of the form is for passing data from several input type field, the route configuration file itself must be defined as follows :