The post method is not supported for this route. Supported methods: GET, HEAD. for login page

I have the following login.blade.php
<form method="POST" action="{{ route('login') }}">
@csrf
<input type="email" name="email" placeholder="Email" required>
<input type="password" name="password" placeholder="Password" required>
<button type="submit">Login</button>
</form>
@if(session('error'))
<p>{{ session('error') }}</p>
@endif
<form method="POST" action="{{ route('login') }}">
@csrf
<input type="email" name="email" placeholder="Email" required>
<input type="password" name="password" placeholder="Password" required>
<button type="submit">Login</button>
</form>
@if(session('error'))
<p>{{ session('error') }}</p>
@endif
web.blade
Route::middleware('checkUserRole')->prefix('admin')->group(function () {
Route::get('/', function () {
return view('welcome');
});
});

Route::get('/login', function () {
return view('login');
})->name('login');
Route::middleware('checkUserRole')->prefix('admin')->group(function () {
Route::get('/', function () {
return view('welcome');
});
});

Route::get('/login', function () {
return view('login');
})->name('login');
keep show the error even when I add @method('PUT') for login.blade #"laravel"
1 Reply
ἔρως
ἔρως10mo ago
you have 2 routes with get, but none that accept post. either change the method="post" to method="get" (bad idea) or add a Route::post or change /login to Route::post.
Want results from more Discord servers?
Add your server