The GET method is not supported for this route. Supported methods: PATCH

  • 03-07-2022
  • 991
  • Laravel 9
  • Haresh Chauhan

The GET method is not supported for this route. Supported methods: PATCH. This error occurs when you are trying to put the patch method in the form method attribute and then submit your form.

Basically the HTML not support the different method in the form that what provided by the laravel different methods.

That's why we need to bind that other method inside the blade file form using laravel attributes like @method('PATCH').

Here is the solution on how to handle all the different routes method in HTML form in the blade file laravel.

Route

This is my route-defined URL user/registration. Where I used the patch method for this route method request.

Route::patch('user/registration','HomeController@index')->name('user.register');

Form Method Handled

This is the form, Inside the form method attribute i used post method, But inside the form i have define patch method. So that route can access patch method from the form request.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Webappfix</title>
</head>
<body>
        // add post method in form method attribute instead of patch
        <form action="{{ route('user.register') }}" method="post">
            @method('PATCH') // add Patch method form 
            @csrf
        <label for="name">Name :</label>
        <input name="name" id="name" type="text">
        <label for="email">Email :</label>
        <input name="email" id="email" type="email">
        <label for="mobile">Mobile :</label>
        <input name="mobile" id="mobile" type="mobile">
        <input type="submit">
    </form>
</body>
</html>

We always thanks to you for reading our blogs.


dharmesh-image

Dharmesh Chauhan

(Swapinfoway Founder)

Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us

haresh-image

Haresh Chauhan

(Co-Founder)


We Are Also Recommending You :