Reputation: 77
My current url I'm on is localhost/test/1
When I click on save button, it's going to call a rest service test/{id}/createNewTest. How do I get the {id} in the controller? Right now it's getting nothing.
Route::post('test/{id}/createNewTest', 'TestController@createNewTest');
public function createNewTest() {
$id = Request::input('id');
}
the $id is suppose to be 1 here, but it's getting nothing
Upvotes: 1
Views: 1405
Reputation: 62368
Route parameters are passed into the controller via method parameters, not as request input:
public function createNewTest($id) {
var_dump($id); // from method parameter, not Request::input()
}
Upvotes: 1