PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 16, 2022

[FIXED] The POST method is not supported for this route. Supported methods: PUT, PATCH, DELETE

 February 16, 2022     eloquent, laravel-5, php, web     No comments   

Issue

It's not working showing this

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException The POST method is not supported for this route. Supported methods: PUT, PATCH, DELETE.

<form class="form-ad" action="{{ route('jobs.store') }}" method="post" >

Solution

Fake your patch request like this in form tag

<form class="form-ad" action="{{ route('jobs.store') }}" method="post" >
{{ method_field('POST') }} /*here i used post and solved the error*/ /*if you are using form method POST then what is the use of using {{method_field('POST')}} form "store" action? {{method_field('POST')}} is mainly used if you have a PATCH request for update action. Store action is already on POST request in your Routes.*/
<!-- rest of the form -->
</form>

Also, just a suggestions that you can simply make a resource full route.

First make a controller resourceful from artisan command, which will create all the methods required for each method (get, post, patch etc.)

php artisan make:controller Jobs -r

then in your routes/web.php use

Routes::resource('jobs');

You can also view your routes using php artisan command

php artisan route:list


Answered By - Danish Hakim Khan
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing