The Get Method Is Not Supported for This Route. Supported Methods: Put. But I'M Using Put

Laravel The GET method is not supported for this route. Supported methods: PUT. Yet i am using PUT method

You cannot use PUT in the form method attribute:
use "post" and the blade directive @method

<form method="post" action="wipe">
@method('PUT')

However to delete a user, maybe the DELETE method is a better option? (implement the same way as the PUT method)

LARAVEL 9 The PUT method is not supported for this route. Supported methods: GET, HEAD

I'd make these modifications to your code:
edit.blade:

 <form action="/admin/category/update/{{$data->id}}" method="POST">
@csrf
@method('PUT')
.........

Route:

Route::put('/admin/category/update/{id}', [AdminCategoryController::class,'update'] )->name('admin_category_update');

Check if it works.

One more thing: If you correctly created model binding, your update function could look like this:

public function update(Request $request, Category $category, $id)
{
//
$category->parent_id = 1;
$category->title = $request->title;
$category->keywords = $request->keywords;
$category->description = $request->description;
$category->status = $request->status;
$category->save();
return redirect('admin/category');
}

That is because you already have the model right there: public function update(Request $request, **Category $category**, $id)

The GET method is not supported for this route. Supported methods: POST. with laravel

please use this once .

php artisan cache:clear,
php artisan route:cache,
php artisan view:clear,
composer dump-autoload

How do I fix The GET method is not supported for this route

try changing your route to:

Route::any('/site/{id}', [SiteController::class, 'store'])->name('site');

and see how its sending the datas. post the entire form here. there must be an error in that.

Error: 'The GET method is not supported for this route. Supported methods: PATCH, DELETE.' accessing a route

I think the meeting id is detected as a string. removes the where() to match it and it's better to use route() to generate a route.

file web.php:

...
Route::get('/meeting/{id}', [MeetingController::class, 'show'])->name('meeting.show')
...

the blade:

<a href="{{ route('meeting.show', $meeting['id']) }}" class="stretched-link text-white">{{ $meeting['name'] }}</a>

The POST method is not supported for this route. Supported methods: GET, HEAD, PUT, PATCH, DELETE. in Laravel 8

In your case, it should be {{ route('especialidades.store') }}

The reason being that default method for creating a row in db in a resource controller is App\Http\Controllers<YourResourceControllerName>@store

/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}

/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}

/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}

/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}

/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}

Here the create method is only for showing the form of the store method and not the function for storing the data itself.

The post method is not supported for this route. Supported methods: get, head Laravel 8

Inside your form, you are using the route with the GET method instead of the route with the POST method. You are also using the function url instead of route. And instead of image-upload it should be image.upload with a dot .

So, you should change action="{{url('image-upload')}}" to action="{{route('image.upload.post')}}"

This is how your form should look like:

<form action="{{route('image.upload.post')}}" enctype="multipart/form-data" method="post">
@csrf
<input type="file" name="file">
<input type="submit">
</form>


Related Topics



Leave a reply



Submit