我无法让我的控制器收听 DELETE 请求。当我向 /api/players/1 发送 DELETE 请求时,我得到了 NotFoundHttpException。这是我的 routes.php
Route::group(array('prefix' => 'api'), function() {
Route::controller('matches', 'MatchController');
Route::controller('players', 'PlayerController');
Route::controller('auth', 'AuthController');
});
我的播放器控制器
class PlayerController extends BaseController {
public function getIndex() {
// do something... this works
}
public function postIndex() {
// do something... this works
}
public function deleteIndex() {
// works when I send a DELETE request to /api/players
}
public function delete($id = null) {
// doesn't work!
}
}
我想我错过了某种秘密词或其他东西......我只是不知道如何捕捉带有 id 的 DELETE 请求。我究竟做错了什么?