Try this instead
{{ route('student.destroy', ['id' => $student->id]) }}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello. I had confused with that error above and I double check that code I include the parameter. Check my code below
<form action="{{ route('student.destroy', $student->id) }}" method="POST" onsubmit="return confirm('Are you sure you want to unenroll?');" style="display: inline-block;">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="hidden" name="_method" value="DELETE">
<input type="submit" class="btn btn-danger" value="Unenroll">
</form>
My code in controller
public function destroy($id)
{
$student = Student::where('student_id', $id)->first();
//reset to active
if ($student->enrolled == 0){
$student->enrolled = 1;
$student->save();
return redirect()->back()->with('success','Student was successfully enrolled');
}
else{
$student->enrolled = 0;
$student->save();
return redirect()->back()->with('error','Student is now unenrolled');
}
}
I'm still wondering why I get the error missing required parameters even I had already that one.
Try this instead
{{ route('student.destroy', ['id' => $student->id]) }}
Please or to participate in this conversation.