Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #500
    jacob_smith
    Participant

    Hi, I really don’t understand why its throwing me this error in production but not in local development

    ” (Illuminate\Routing\Exceptions\UrlGenerationException(code: 0): Missing required parameter for [Route: questions.show] [URI: questions/{question}] [Missing parameter: question] ”

    Here is my route in web.php

    Route::get(‘/questions/{question}’, [QuestionController::class, ‘show’])->name(‘questions.show’);

    And the page the throws that error includes the following code:

    <a* href=”{{route(‘questions.show’, $question)}}”>

    </a*>

    Again this works in local but its throwing me the error in production. I also changed the parameter field from $question to ‘question’ => $question but still not working

    #504

    The code is right. Just check on the $question model you passed to the route questions.show and check if it is returning to null.

    It could be that some of the model have null id attribute value of null. Or if you are still in the development stage and the data are fakes, you can do remigrate you tables and repopulate you data

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.