Recent Topics

Getting exception : Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException



  • I have created a new datagrid and added a mass update action for it. But after post, it shows 500 error. Grid showing proper data. I want to generate a PDF report for the selected data. This is my code

    Mass action in grid

    $this->addMassAction([
                'type' => 'View',
                'label' => trans('marketplace::app.admin.orders.report'),
                'action' => route('admin.marketplace.sellers.printvendorreport'),
                'method' => 'PUT'
            ]);
    

    at the address bar , it shows

    public/admin/marketplace/null
    

    This is my route

    Route::put('printvendorreport', 'Webkul\Marketplace\Http\Controllers\Admin\[email protected]')->defaults('_config', [
                        'redirect' => 'admin.marketplace.sellers.vendorreport'
                    ])->name('admin.marketplace.sellers.printvendorreport');
    

    I am getting "Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException"
    how can I get this working



  • Hi @ppstech

    Change your routes's method to 'post' instead of 'put'.

    Route::post('printvendorreport', 'Webkul\Marketplace\Http\Controllers\Admin\[email protected]')->defaults('_config', [
                        'redirect' => 'admin.marketplace.sellers.vendorreport'
                    ])->name('admin.marketplace.sellers.printvendorreport');
    

    Thanks



  • Hi @rahul
    I have changed the route, but still the issue is there.



  • Hi @ppstech

    After changing put to post. Did you run 'php artisan route:cache' ?

    Thanks



  • Hi @rahul ,
    yes, I have run 'php artisan route:cache' command.
    And as I mentioned earlier, it is redirection to 'public/admin/marketplace/null' instead of the mentioned route



  • Hi @ppstech

    Can you show your controllers code for delete ?

    Thanks


Log in to reply