Error 405 (Method Not Allowed) Laravel 5

Error 405 (Method Not Allowed) Laravel 5

The methodNotAllowed exception indicates that a route doesn't exist for the HTTP method you are requesting.

Your form is set up to make a DELETE request, so your route needs to use Route::delete() to receive this.

Route::delete('empresas/eliminar/{id}', [
'as' => 'companiesDelete',
'uses' => 'CompaniesController@delete'
]);

405 Method not allowed in Laravel 5.6.14

Change you store route like this:

Route::post('article/store', 'ArticleController@store');

Because you send post request from Postman to

/article/store

Sample Image

Laravel 5.4 Error 405 Method Not Allowed Error

You're attempting to make a request that is unauthorized or otherwise not configured correctly. 405 means unauthorized HTTP verb in the request. Double check your route files that you can POST to the route you want to reach.

Anytime I see this is when I accidentally try to use GET on a POST route or similar.

And since you mentioned CORS, make sure all the required verbs are listed as allowed.

How to hide Laravel's 405 Method Not Allowed error screen?

Thanks to @Don'tPanic in the comments of my question, I found the answer.

Laravel offers the option to hide 405 error screen.

You can change 405 error to 404 error and display 404 Not Found error page instead of 405 error page without writing code in every controller action method.

For more detail, see the answer and documentation below:

how to handle 405 error for displaying as webpage laravel

The Render Method
https://laravel.com/docs/5.8/errors#render-method



Related Topics



Leave a reply



Submit