The PUT method is not supported for this route. Supported methods: GET, HEAD, POST. in laravel

the post method is not supported for this route error in laravel
laravel route group example
laravel route parameters controller
laravel ajax url route with parameters
route::post method not allowed laravel
laravel route api
route::post method not allowed laravel
laravel route middleware

i want to do seller can edit and update product

this is ProductController

public function edit($id)
    {
        $product = Product::find($id);
        return view('product.edit', compact('product'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        $product = Product::find($id);
        $product-> title = $request-> title;
        $product-> description = $request-> description;
        $product-> price = $request-> price;

        if($request->hasFile('image')){
            $file = $request-> file('image');
            $filename = time().'.'.$file-> getClientOriginalExtension();
            $location = public_path('/images');
            $file-> move($location, $filename);
            $oldImage = $product->image;
            \Storage::delete($oldImage);
            $product-> image= $filename;
        }
        $product-> save();

        return back();
    }

this is edit.blade.php

<form action="{{route('product.update', $product->id)}}" method="post" enctype="multipart/form-data">
        {{csrf_field()}}
        {{method_field('put')}} 
[...]

<button type="submit" class="btn btn-success">Submit</button>

this is web.php

Route::get('/index', 'ProductController@index');//seller view all product

Route::get('/create', 'ProductController@create'); //seller create new product
Route::post('','ProductController@store')->name('product.store'); //store in database

Route::get('/edit/{id}','ProductController@edit'); // seller edit post
Route::post('','ProductController@update')->name('product.update'); //seller update

when i click submit button for update The PUT method is not supported for this route. Supported methods: GET, HEAD, POST. show up

how i can fix it? PLEASE HELP

Try again please;

Route::put('edit/{id}','ProductController@update')->name('product.update');

and

<form action="{{ route('product.update', ["id" => $product->id]) }}" method="post" enctype="multipart/form-data">
{{ csrf_field() }}
{{ method_field('put') }}
[...]

<button type="submit" class="btn btn-success">Submit</button>

The POST method is not supported for this route , Supported methods: GET, HEAD. I have no clue where it comes from as I am pretty new to Laravel. routes(web.php): Route  The most concise screencasts for the working developer, updated daily. There's no shortage of content at Laracasts. In fact, you could watch nonstop for days upon days, and still not see everything!

You should use PUT in route;

Route::put('','ProductController@update')->name('product.update');

And not produc.update not except product->id

<form action="{{route('product.update')}}" method="post" enctype="multipart/form-data">
        {{csrf_field()}}
        {{method_field('put')}} 
[...]

<button type="submit" class="btn btn-success">Submit</button>

"POST Method Not Supported For This Route" : laravel, Supported methods: GET, HEAD, PUT, PATCH, DELETE." I'm not really sure what's going on, but I know that it *SHOULD* support it; when I php artisan route:​list  And when I use in my postman method PUT I received this message "The PUT method is not supported for this route. Supported methods: GET, HEAD, POST." in my api.php I have the following line:

You need to pass the id parameter in your form request like below:

<form action="{{ route('product.update', $product->id) }}" method="post" enctype="multipart/form-data">
{{ csrf_field() }}
{{ method_field('put') }}
[...]

<button type="submit" class="btn btn-success">Submit</button>

And then modify your controller method to be as below:

Route::put('edit/{id}','ProductController@update')->name('product.update');

This is because your controller method is expecting an id to be passed through in the request but isn't actually receiving one, hence the error.

I hope this helps!

The POST method is not supported for this route - php, Supported methods: GET, HEAD. i have no clue where it comes from as i am pretty new to laravel. routes(web.php): Route::group(['middleware' => 'auth'], function the #method('PUT') in your form, so let's say we'll just plainly use the POST  Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException The PUT method is not supported for this route. Supported methods: GET, HEAD, POST. Not sure what is causing the error, help appreciated.

HTTP Routing - Laravel, The GET method is not supported for this route. Supported methods: POST I am trying to get a response in dev.site.com.br/api/auth/me and I have the error for this route. Supported methods: POST - Laravel 5.8 #1843. Open. I am having issues while using laravel resourceApi controller along with vue js i am creating and application where i am using vue and laravel i am posting a value to store method of my controller but it is saying the method is not allowded or 405 exception in the response. i need some help i am new to laravel and vue.

The GET method is not supported for this route. Supported methods , Laravel - The PUT method is not supported for this route. Supported methods: GET, HEAD. I am working on a web application using Laravel-5.8. return redirect()->route('hr.holiday_groups.index'); } public function destroy(Request $​request,  That's because the you're passing DELETE method as the method of your form, and it is wrong, the right thing to do is pass de POST method. Check this example:

Laravel, 1. Supported methods: GET, HEAD. Forum Laravel The POST method is not supported for this route. Supported methods: GET, HEAD, PUT, PATCH, DELETE​. pereiracinthiag changed the title The GET method is not supported for this route. Supported methods: POST The GET method is not supported for this route. Supported methods: POST - Laravel 5.8 Jul 9, 2019

Comments
  • kindly, update your previous answer, if it does not solve the problem
  • what if the seller want to delete the product how i can do that <form action="{{ route('product.destroy', ["id" => $product->id]) }}" method="post"> {{csrf_field()}} {{method_field('DELETE')}} <button type="submit" class="btn btn-sm btn-danger">Delete</button> </form> Route::delete('','ProductController@destroy')->name('product.destroy');//seller delete product i try this but error
  • Too few arguments to function App\Http\Controllers\ProductController::update(), 1 passed and exactly 2 expected
  • @user12149659 Just change the form action route to <form action="{{route('product.update', $product->id)}}