Answer the question
In order to leave comments, you need to log in
How to properly pass variable to controller via routes.php in Laravel?
Here is the code that, according to the idea, should pass $id to the controller.
Route::get('categories/id/{$id}', '[email protected]');
class CategoriesController extends BaseController {
public function testListByID($id)
{
echo $id;
}
}
Answer the question
In order to leave comments, you need to log in
Route::get('categories/id/{$id}', '[email protected] postListByID ');
and in the controller...
public function testListByID ($id)
Not so - vtest/public your url should be something like
localhost:8000/categories/id/2
if without using an internal server, then specify a virtualhost.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question