Monday, February 27, 2017

[SOLVED] Missing required parameters while param is filled in in URL

I'm working on a Laravel project, where I have the following routes:
Route::group(['middleware' => ['web', 'auth'], 'prefix' => 'deliver'], function () {
    Route::get("{pitch}/play", "DeliverController@play")->name("deliver.play");
    Route::get('/', 'DeliverController@index')->name('deliver');
});

The route named deliver.play is being called like this:
 <a href="">
     <span class="glyphicon glyphicon-picture" data-toggle="tooltip" data-placement="top" title="Go to Playmode"></span>
 </a>

As you can see, I pass the $pitch parameter to the route, however, on execution, the following error pops up:
ErrorException in UrlGenerationException.php line 17:
Missing required parameters for [Route: deliver.play] [URI: deliver/{pitch}/play].

Which normally means the {pitch} param isn't given, however, in the URL bar of my browser the param is there, giving me the complete URL of
http://localhost:8000/deliver/empty-pitch-13/play
So how is it possible for Laravel to not see the parameter im passing on to the route? Or is there something that I'm missing?
Thanks.


from Latest question asked on Laravel tag.

via Wesley Peeters

Advertisement