我正在使用资源 Controller 来处理我网站中的帐户。 这是我的路线:
Route::group(['before' => 'auth'], function() {
Route::resource('/account', 'AccountController');
});
这是我的 Controller :
class AccountController extends \BaseController {
public function index() {
return Redirect::action('AccountController@show', Sentry::getUser()->id);
}
public function show($id) {
return $id;
}
public function edit($id) {
}
public function update($id) {
}
public function destroy($id) {
}
}
我使用命令行创建了 Controller :'php artisancontroller:make AccountController -- except=store,create'
尽管由于某种原因,我在导航到该 URL 时收到了 NotFoundHttpException。
但我不知道为什么。可能是什么原因造成的?
编辑:
过滤器:
Route::filter('auth', function()
{
if ( ! Sentry::check() ) return Redirect::action('HomeController@getLogin');
});
最佳答案
我修复了它,我不知道问题是什么,但我将路由组移到了routes.php 文件中的第一行,它的工作方式就像一个魅力。
关于php - Laravel 4 资源 Controller NotFoundHttpException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17172049/