Reputation: 155
I have been trying to get a value out of my route but it wont work.
My Route:
Route::post('/credentials/{info}');
My controller function:
public function getInfo()
{
dd($info);
}
Upvotes: 2
Views: 62
Reputation: 36
Your function needs to be this:
public function getInfo($info)
{
dd($info);
}
And route needs to be like this:
Route::post('/credentials/{info}', 'ControllerName@FunctionName')
Upvotes: 1
Reputation: 50491
You need to define the method to accept that parameter if you want it passed to it by the router:
public function getInfo($info)
{
dd($info);
}
Laravel 6 Docs - Controllers - Defining Controllers
Laravel 6 Docs - Routing - Route Parameters
Upvotes: 1