I have a route like this
Route::get('/vcs-integrations/{vcs-provider}/authenticate','VcsIntegrationsController@authenticate');
and the method to handle the route I am using the model route binding to happen is as follows
<?php
....
use App\Models\VcsProvider;
....
class VcsIntegrationsController extends Controller
{
public function authenticate(VcsProvider $vcsProvider, Request $request)
{
...
// some logic
...
}
}
when I try to access the route I am getting 404 due to the parameter name is not matching.
So, how do I know the parameter name expected by laravel in route model binding ?
From the route parameter docs:
You should be able to define the parameter as
{vcs_provider}in the route definition and then use$vcs_providerfor the parameter name in the method signature if you would like. You can also name it not using the_if you prefer, but just avoid the-, hyphen, when naming.Have fun and good luck.