Laravel “The GET method is not supported for this route. Supported methods: POST.” Error Resolution
The Laravel update screen (form) was displayed using POST, and when I tried to access the update screen directly via URL, the error message
“The GET method is not supported for this route. Supported methods: POST.”
was displayed.
Here, I will introduce the solution I used at that time.
Cause of “The GET method is not supported for this route. Supported methods: POST.”
“The GET method is not supported for this route. Supported methods: POST.”
When translated using Google Translate, it becomes:
“The GET method is not supported for this route. Supported methods: POST.”
As the translation suggests, it means:
“GET (direct URL access) is not supported, and only POST access is supported.”
Route (routes/web.php) Description
The following was written as the method for displaying the update screen.
//Display update screen
Route::post('/productsedit/{products}','ProductsController@edit');
Solution: Add GET to Route (routes/web.php)
Simply add “Route::get” before “Route::post” in the Route (routes/web.php) description.
//Display update screen
Route::get('/productsedit/{products}','ProductsController@edit'); //Added GET
Route::post('/productsedit/{products}','ProductsController@edit');
By adding “Route::get”, the update screen can now be displayed directly via URL without showing the error message that GET is not supported.
Not only update screens, but also screens that are displayed by POST submission from a form—for example, if you have bookmarked a URL and later try to access it directly—the error message
“The GET method is not supported for this route. Supported methods: POST.”
may be displayed. In such cases, please try the solution described in this article.
Summary
The error message “The GET method is not supported for this route. Supported methods: POST.” that occurs when trying to display a Laravel update screen directly via URL can be resolved by adding the GET method to routes/web.php.
This allows the route to support both GET and POST methods, improving usability. Please try this in your actual project.
*If you reuse this information, please do so at your own responsibility.*