'DELETE method is not supported for this route. Supported methods: GET, HEAD, POST

I'm using laravel 9.x my route is

Route::middleware('verified')->group(function (){
    
    Route::get('dashboard', function () {
        return view('dashboard');
    })->name('dashboard');
    
    Route::resource('kullanicilar', UserController::class);    
});

and my controller has destroy methods

public function destroy($id)
    {
        
        echo 'destroy'.$id;
        //User::find($id)->delete();
        //return redirect()->route('kullanicilar.index')
        //    ->with('success','Kullanıcı başarı ile silindi.');
        
    }

and my user_index.blade.php

<form method="POST" aciton="{{ route('kullanicilar.destroy',$user->id) }}" style="display:inline">
   @csrf
   @method('DELETE')
   <button type="submit" class="btn btn-sm btn-danger"><i class="fa fa-times"></i></button>
</form>

even though everything seems to comply with the rules, I'm getting this error.

enter image description here



Solution 1:[1]

You have a typo in the action element causing the form to be posted back to the same route as the original page;

<form method="POST" aciton="{{ route('kullanicilar.destroy',$user->id) }}"

note action is misspelled

Also, as you are using resource controller, you should accept the model in the destroy method.

Use Route::list to check what your controller should accept

Solution 2:[2]

action NOT aciton in Your Form Ex :

<form method="POST" action="{{ route('kullanicilar.destroy',$user->id) }}" 
  style="display:inline">
   @csrf
   @method('DELETE')
   <button type="submit" class="btn btn-sm btn-danger"><i class="fa fa-times"></i></button>
</form>

Solution 3:[3]

I found the solution by overriding the destroy method with get on the web.php route. it's working for me for now.

such as

 //this should be at the top
Route::get('kullanicilar/remove/{id}', [UserController::class,'destroy'])->name('kullanicilar.remove'); 
Route::resource('kullanicilar', UserController::class); 

and change my user_index.blade.php

<a href="{{ route('kullanicilar.remove',$user->id) }}"  title="Sil" class="btn btn-sm btn-danger"><i class="fa fa-times"></i></a>

it works.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Snapey
Solution 2 Joukhar
Solution 3 blackmamba