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
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()
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.