PHP: Supported methods: GET, HEAD” Laravel

Sometimes, you may face an issue with your edit page. When you submit, this error occurs:

How to fix error “PHP: The POST method is not supported for this route. Supported methods: GET, HEAD”

You have no idea where that originated, as you are relatively new to Laravel.

routes(web.php):

Route::group([‘middleware’ => ‘auth’], function () {

Route::get(‘/’, ‘ProjectController@index’);

Route::get(‘/projects/{id}’, ‘ProjectController@show’);

Route::post(‘/create’,’ProjectController@store’);

Route::get(‘/create’, ‘ProjectController@create’);

Route::get(‘/projects/{id}/delete’, ‘ProjectController@destroy’);

Route::put(‘/edit’,’ProjectController@update’);

Route::get(‘/projects/{id}/edit’, ‘ProjectController@edit’);

});

 

Controller:

public function edit($id)

{

return view(‘project.edit’,[

‘project’ => Project::find($id)

]);

}

/**

* Update the specified resource in storage.

*

* @param  \Illuminate\Http\Request  $request

* @param  int  $id

* @return \Illuminate\Http\Response

*/

public function update(Request $request)

{

$project = Project::find($request->id);

$project->project_name = $request->input(‘project_name’);

$project->client = $request->input(‘client’);

 

$project->description = $request->input(‘description’);

$project->time_span = $request->input(‘time_span’);

$project->text_report = $request->input(‘text_report’);

$project->created_by = $request->input(‘created_by’);

$project->save();

return  redirect(‘/’)->with(‘success’, ‘Project aangepast’);

}

 

There are various ways to handle this situation:

If you insist on using PUT, you can change the form action to POST and add a hidden method field with the value PUT as well as a hidden csrf field (if you’re using blade, simply add @csrf field and method field(‘PUT’) ). The form would then accept the request.

Simply update the form’s route and method to POST. Since you are the one specifying the route and not the resource group, it will function properly.

You may aware that this is not the answer to the OP’s question. However, Google indexed this site #1 when I looked for solutions to this problem. I believe that this will benefit others for this reason.

  • The subsequent error…
  • This route does not support the POST method. Methods supported: GET and HEAD.

caused by failure to delete the routing cache.

php artisan route:cache

add @method(‘PUT’) on the form

Exp:

<form action=”…” method=”POST”>

@csrf 

@method(‘PUT’)

</form>

In your situation, simply executing the command worked like a charm.

php artisan route:clear

You can change the /managers/games/id/push/ link by removing the final slash and it will start working.

$http({

method: ‘POST’,

url: “/managers/games/id/push”,

Possible cause: You haven’t yet upgraded to Laravel 5.8.

The following is how your code will appear in web.php:

Route::post(‘/edit/{id}’,’ProjectController@update’);

First, we get rid of the random parameter id so that it looks like this:

Route::post(‘/edit’,’ProjectController@update’);

Second, ditch the @method(‘PUT’) from your form; in this case, we’ll stick with the tried-and-true POST method.

But how can you send that identifier to my method?

The first thing you need to do is create a form input field and give it the hidden property.

A hidden input with the following parameters:

 input type=”hidden”, value=”$project->id”, name=”id”>

You’ll need to retrieve that ID in the update method of your controller.

$id = $request->input(‘id’);

Consequently, you cannot utilise it to determine which work needs updating.

$project = Project::find($id)

//OR

$project = Project::where(‘id’,$id);

The simple way to fix this is to add this to your form.

 

 

 

{{ csrf_field() }}

<input type=”hidden” name=”_method” value=”PUT”>

then the update method will be like this :

public function update(Request $request, $id)

{

$project = Project::findOrFail($id);

$project->name = $request->name;

$project->description = $request->description;

$post->save();

}

 

If you are using a Route::group, with a vendor plugin like LaravelLocalization (from MCAMARA), you need to put POST routes outside of this group. I’ve experienced problems with POST routes using this plugin and I did solved right now by putting these routes outside Route::group..

Just name your routes.

Route::post(‘/{page}/articles’, AddArticle::class)->name(‘addArticle’);

Not all of the paths need to be written out, just stick to the standard procedures. ITtutoria.net is also available to help with any problem.

We hope you will find the Solution!!!

Check out: Programming Languages For eLearning App Development

Most Popular

More from Author

What are DoS and DDoS Attacks & How to Prevent Them?

In today's interconnected world, where businesses and organizations increasingly rely on...

10 Reasons Why SEO is Important for Your E-commerce Website

E-commerce has revolutionized how businesses reach customers, but success in this...

How to upload Instagram videos to Snapchat

Social media platforms are constantly evolving, and content creators are always...

Read Now

The Best Practices to Enhance Your Chatbot Security

In 2025, chatbots have evolved to become crucial tools in customer service, sales, and user interaction. However, with this increased reliance on AI-driven automation comes an increased risk of cyberattacks and data breaches. Safeguarding these intelligent systems has never been more critical. Chatbot security plays a central...

What are DoS and DDoS Attacks & How to Prevent Them?

In today's interconnected world, where businesses and organizations increasingly rely on digital platforms to operate, cyber threats are a growing concern. Among these, Denial of Service (DoS) and Distributed Denial of Service (DDoS) attacks are among the most common and damaging threats. These attacks can bring down...

10 Reasons Why SEO is Important for Your E-commerce Website

E-commerce has revolutionized how businesses reach customers, but success in this space isn't guaranteed. Simply having an online store is not enough; without visibility, your products remain hidden in the vast sea of competition. That’s where SEO for e-commerce websites comes in. SEO (Search Engine Optimization) is the...

How to upload Instagram videos to Snapchat

Social media platforms are constantly evolving, and content creators are always looking for new ways to cross-post their videos for maximum exposure. Instagram and Snapchat, two of the biggest social media giants, have different content formats, but that doesn't mean you can’t share videos between them. Many users...

How To Blur Images on Instagram: Complete Guide

Blurring images on Instagram is a great way to add artistic effects, emphasize subjects, or hide sensitive information. While Instagram lacks a direct blur tool, you can still achieve blur effects using filters, third-party apps, or editing techniques. Whether you’re trying to create a soft-focus background, blur...

Google Play Music Makes File Transfer Easier From Play Music

Google Play Music has long been a favorite platform for streaming and storing personal music collections. With its easy file transfer options, users can move their music across devices or migrate their library to other platforms without hassle. Whether you're switching to YouTube Music, downloading your library,...

How to Download Videos Online? Alternative Ways

Many users want to download videos online for offline access, archiving, or personal use. However, different websites have various restrictions on downloading their content. Some platforms allow direct downloads, while others require third-party tools or alternative solutions. To help you save videos safely and efficiently, we have compiled...

How to Get the Comic Filter on TikTok?

TikTok is constantly rolling out new and exciting features to enhance creativity and engagement. One of the most trending effects people are using today is the comic filter on TikTok, which transforms faces into animated, comic-style illustrations. Whether you want to give your videos a fun, artistic...

How to Monetize YouTube Shorts: The Ultimate Guide

YouTube Shorts has taken the world by storm, becoming a major competitor to TikTok and Instagram Reels. But in 2025, Shorts is no longer just about creativity—it's a massive opportunity to earn money. With expanded monetization options, creators now have multiple ways to turn their short videos...

YouTube Upgrades: Latest Features and Innovations

YouTube has once again raised the bar with its latest update, version 20.09.39, released on March 8, 2025. This update is packed with advanced AI-driven tools, new monetization features, enhanced video playback, and interactive live streaming enhancements. Whether you are a content creator, marketer, or casual viewer,...

SQL Injection Attacks: Understanding the Risks

Web applications are a fundamental part of modern technology, from e-commerce sites to enterprise software. However, they can also be prime targets for malicious actors seeking to exploit vulnerabilities. Among the most dangerous and widespread threats to web applications are SQL injection attacks. These attacks exploit weak...

Common Network Security Vulnerabilities

We live in an era of constant connectivity. Our networks are the lifeblood of business and communication, yet they are under constant threat. Network security vulnerabilities are more than just a technical issue; they are an ongoing battle to safeguard our most valuable information. If left unchecked,...