I am using Laravel 5.6 and MySQL. I am going to update the student table using the following controller function:
public function update(Request $request, $id)
{
$students = Student::find($id);
$students->name = $request->input('name');
$students->town = $request->input('town');
$students->save();
}
and the update form action looks like this:
<form action="{{route('student.update',$students->id)}}" method="POST">
{{csrf_field()}}
and my route is define like this:
Route::resource('student','StudentController');
My problem is, when I click the update button in the form it generates the following error message
1/1) MethodNotAllowedHttpException
What's wrong?