Missing required parameter for [Route: edit.question] [URI: editquestion/{question}] [Missing parameter: question]

Published

I’m working with Laravel 8 to develop my forum project and in this project, I want to make an editquestion page that users can edit their questions.

So here is a button on blade that redirects user to that edit page:

<form action="{{ route('edit.question', $show->slug) }}">
   <button type="submit" class="text-blue-500 BJadidBold">Edit Question</button>
</form>

And this the route for showing the editquestion blade:

Route::get('editquestion/{question:slug}' , [QuestionController::class, 'editQuestion'])->name('edit.question');

And this is the Controller method editQuestion() which returns this blade:

public function editQuestion(Question $slug)
    {
        return view('questions.editquestion',[
            'slug' => $slug
        ]);
    }

But now, whenever I click on Edit Question, I get this error:

Missing required parameter for [Route: edit.question] [URI: editquestion/{question}] [Missing parameter: question]

So what is going wrong here? How can I solve this issue?

Thanks for helping out.

Source: Laravel

Published
Categorised as laravel, laravel-8, php Tagged , ,

Answers

Leave a Reply

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq