MethodNotAllowedHttpException - put and delete

the delete method is not supported for this route supported methods post
laravel delete method
put method in laravel
the patch method is not supported for this route
laravel destroy method
laravel update route

I want to delete an item but I got this error message:

 (1/1) MethodNotAllowedHttpException

in RouteCollection.php line 255
at RouteCollection->methodNotAllowed(array('PUT', 'DELETE'))

my routes:

Route::group(['prefix' => '/Seller', 'middleware' => ['seller_access']], function ()  {

    Route::get('/','Seller\SellerController@index')->name('seller');

    Route::group(['prefix' => '/Products'], function ()  {
        Route::get('/', 'MarketingBundle\Seller\Product\ProductController@index')->name('marketing.seller.product.index');
        Route::delete('/{id}', 'MarketingBundle\Seller\Product\ProductController@delete')->name('marketing.seller.product.delete');
        Route::put('/{id}', 'MarketingBundle\Seller\Product\ProductController@update')->name('marketing.seller.product.update');
    });

my url:

Seller/Products/228

my controller:

class ProductController extends Controller
{

    public $resources = "marketing.seller.product";


    public function index(Request $request)
    {

        $products = \Auth::user()->sellerProduct()->paginate(10);
        return view($this->resources . '.index', [
            'products' => $products
        ]);
    }

    /**
     * @param $product_id
     * @return \Illuminate\Http\JsonResponse
     */
    public function delete($product_id)
    {
        dd("masoud");
        \Auth::user()->sellerProduct()->detach(['product_id' => $product_id]);
        return response()->json(['status' => true]);
    }

re-order your routes like this.

Route::delete('/{id}', 'MarketingBundle\Seller\Product\ProductController@delete')->name('marketing.seller.product.delete');
Route::put('/{id}', 'MarketingBundle\Seller\Product\ProductController@update')->name('marketing.seller.product.update');
Route::get('/', 'MarketingBundle\Seller\Product\ProductController@index')->name('marketing.seller.product.index');

Form DELETE/PUT with _method POST is not working, Laravel 5.4 Trying to figure out why my DELETE request not working.. I'm using Postman and RESTClient in Firefox to test an API in Laravel 5.4  I'm developping a public API since a couple of month under Laravel 5 and ran into a odd issue : All the methods PATCH, PUT and DELETE aren't working. My local env : Ubuntu 14.04 LTS, PHP 5.6 (also tried with 5.5), Nginx 1.6.2, and latest


This is from the laravel documentation:

Any HTML forms pointing to POST, PUT, or DELETE routes that are defined in the web routes file should include a CSRF token field. Otherwise, the request will be rejected. You can read more about CSRF protection in the CSRF documentation:

MethodNotAllowedException most likely has somehting to do with the csrf token, did you add this in your view when posting to the delete function? It means your view needs to have something like this:

<form>
   @csrf
   <button></button>
</form>

MethodNotAllowedHTTPException on API REST DELETE request, For example, if you have a blog post entry then you could use the same URL path to show it, make changes to it and delete it by matching on GET, PUT and  MethodNotAllowedHttpException on Delete route Posted 4 years ago by IsaacBen. I already have multiple delete forms which work very well. With this one I have a


In order for laravel to know you're sending a patch or delete request you need to add a method field into your forms.

<form method='POST' action='#'>
@csrf
{{ method_field('PATCH') }} 
</form>

Documentation https://laravel.com/docs/5.7/helpers#method-method-field https://laravel.com/docs/5.0/routing#method-spoofing

How to Use HTTP Methods beyond GET and POST in Routes (The , HTML form only accept either GET or POST method so you can't use PUT and DELETE in form method. However, if you want to use PUT or DELETE then laravel  According to the routing documentation, Lumen 5.1 should be able to handle delete and put requests. However, I encounter MethodNotAllowedHttpException in Application.php line 1259 with every request:


MethodNotAllowedHttpException when using PUT and DELETE , Laravel: Route :: resource () OTTIENI & POST funziona, ma PUT & DELETE lancia MethodNotAllowedHttpException. Sto scrivendo un'API webservice (in laravel  If you are getting MethodNotAllowedHttpException in Laravel and are unable to figure out the reason, post your questions below. I'll try my best to help you out. Posted in: #PHP


php, MethodNotAllowedHttpException in RouteCollection.php line 218: But for PUT , PATCH , and DELETE methods you need to have a hidden  I am getting MethodNotAllowedHttpException in RouteCollection.php line 207: What would have gone wrong. Please sign in or create an account to participate in this conversation. The most concise screencasts for the working developer, updated daily.


Very Confusing MethodNotAllowedHttpException on a put request , But there's a little trick there which I want to talk about – it's PUT/PATCH/DELETE methods for updating the database entries. Let's remember the  Solved! The answer can be found by running php artisan routes.. That showed me that DELETE and PUT/PATCH expect (require) a bar ID. I happened to be neglecting that because there can only be one of this particular type of “bar”.