Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Bossino's avatar

Missing required parameters for [Route: student.destroy] [URI: student/{student}]

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.

0 likes
10 replies
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Try this instead

{{ route('student.destroy', ['id' => $student->id]) }}
Bossino's avatar

The error is now solved. However, there is another error, The DELETE method is not supported for this route. Supported methods: GET, HEAD, POST.

Bossino's avatar

Just this one sir Route::resource('student', 'StudentController');

kingmaker_bgp's avatar

Just this one sir Route::resource('student', 'StudentController');

@bosspogs This should have added the DELETE Route for the Resource.

Just check whether the Route is listed with the following Artisan Command

php artisan route:list
Sinnbeck's avatar

That is the only route you have in your whole project?

Try running this command and see the route is listed

php artisan route:list
Bossino's avatar

| DELETE | student/{student} | student.destroy | App\Http\Controllers\StudentController@destroy

Sinnbeck's avatar

Ok. Change this in the method

public function destroy(Student $student)

And remove this line

        $student = Student::where('student_id', $id)->first();
1 like
mavutany@gmail.com's avatar

help with this

Missing required parameter for [Route: user-management.destroy] [URI: user-management/{user_management}] [Missing parameter: user_management]. (View: C:\xampp\htdocs\app\resources\views\admin\users-mgmt\index.blade.php)

Please or to participate in this conversation.