我的新路由导致错误,我需要帮助找到它 [英] My new route is causing an error and I need help finding it

查看:151
本文介绍了我的新路由导致错误,我需要帮助找到它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我得到的错误是Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException。

So the error I am getting is Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException.

以下是路线:

Route::get('/', 'AuthController@index');
Route::get('/login', 'AuthController@login');
Route::post('/login', ['before' => 'csrf', 'uses' => 'AuthController@authenticate']);
Route::get('/logout', 'AuthController@logout');

Route::group(['before' => 'auth'], function() {

$noIndex = [ 'except' => ['index'] ];
$noShow = [ 'except' => ['show'] ];

Route::get('/dashboard', 'PagesController@dashboard');

Route::get('/test', 'MessageController@index');


$ b b

这是控制器:

Here is the controller:

/**
 * Display a listing of the resource.
 * GET /test
 *
 * @return Response
 */
public function index()
{
    return View::make('test.index');
}


推荐答案

现在,我们对您的 routes.php 设置有了一些更完整的信息,可能是由于 auth 过滤器的问题。

Now that we have some more complete information regarding your routes.php setup, it's possible that the problem is due to the auth filter.

(我假设您已离开最后的});

(I'm assuming you left off the final }); from your routes.php above.)

尝试删除之前的过滤器(或暂时更改为 before'=> 'none'] )并重新载入 desk.dev:8000/test 。请确保您不要在当前错误页面上单击重新加载,因为它可能指向 desk.dev:8000/login

Try removing the before filter (or change it temporarily to ['before' => 'none']) and reload desk.dev:8000/test. Make sure you don't simply hit reload on the current error page, since it may be pointing to desk.dev:8000/login.

如果您的 AuthController 未设置,或者缺少 login 方法,当 filter.php 中的 auth 过滤器时,获取 NotFoundHttpException 尝试重定向到您的登录页面,具有:

If your AuthController is not set up, or is missing the login method, you will get a NotFoundHttpException when the auth filter in filter.php tries to redirect to your login page, with:

return Redirect::guest('login'); 

这篇关于我的新路由导致错误,我需要帮助找到它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆