The POST method is not supported for this route. Supported methods: GET, HEAD. Laravel 8 error used, what I am doing wrong here?
My form file name -- insertemp.blade.php
<form method="POST" action="/showemployee">
@csrf
<div class="form-group" style="margin-left: 30px">
<label for="id">ID</label>
<input class="form-control" type="number" name="eid" id="empid"><br>
</div>
</form>
My web.php
Route::get('/', function () {
return view('welcome');
});
Route::get('/showemployee',[EmployeeController::class,'show']);
Route::post('/showemployee',[EmployeeController::class,'store']);
My controller file -- EmployeeController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Employee;
class EmployeeController extends Controller
{
public function show()
{
$emp = Employee::all();
return view('showemployee',['employees' => $emp]);
}
public function store()
{
echo "I am in store";
error_log(request('eid'));
return redirect('/');
}
}