After upgrading Laravel 5.8 to 6.0 I get the below error:
local.ERROR: Missing required parameters for [Route:
playlist-song.show] [URI: public/admin/playlist-song/{playlist_song}].
{"userId":1,"exception":"[object]
(Illuminate\Routing\Exceptions\UrlGenerationException(code:
0):Missing required parameters for [Route: playlist-song.show] [URI:
public/admin/playlist-song/{playlist_song}].at
/var/www/vendor/laravel/framework/src/Illuminate/Routing/Exceptions/UrlGenerationException.php:17)
Chrome Inspect Result:
I have tried to find error and update route using _
or -
but still can't solve this error:
any idea to solve this issue?
Thank You in Advance...
===Update
- I suspect error here:
$datatables = app('datatables')->of($model)
->addColumn('action', function ($model) {
return "<a href='". route('playlist-song.show', ['id' => $model->id]) ."' class='btn btn-success btn-sm'><i class='fa fa-eye'></i></a>" .
" <a href='". route('playlist-song.edit', ['id' => $model->id]) . "' class='btn btn-primary btn-sm'><i class='fas fa-pencil-alt'></i></a>" .
" <a href='#' onClick='modalDelete(".$model->id.")' class='btn btn-sm btn-danger'><i class='fas fa-trash'></i></a>";
});
- Update the URL like below still can not solve the problem:
href='". {{ route('playlist-song.show', ['playlist-song' => $model])
}}."'
href="{{ route('playlist-song.show',
['playlist-song' => $model]) }}"
My Answer:
It looks like the issue might be with how you are passing the parameters to the route function in your blade file.
Instead of using ['id' => $model->id], try using ['playlist_song' => $model->id] or whatever the correct parameter name is for the route 'playlist-song.show'.
So your code should look something like this:
php
return " $model->id]) ."' class='btn btn-success btn-sm'>";
Make sure to update all occurrences of route('playlist-song.show') with the correct parameter name.
Also, make sure that the parameter name matches the one defined in your route definition in your routes file.
Hope this helps!
Rate this post
3 of 5 based on 4194 votesComments