尝试登录时出现Laravel 5.5错误

时间:2017-11-01 15:50:51

标签: php laravel laravel-5

我正在尝试使用laravel创建自定义检查。我在LoginController

中添加了此内容
  public function customchecker()
        {


            $credentials = [
              'username'        => Input::get('username'),
              'password'        => Input::get('password')    
            ];

             if (Auth::attempt($credentials)) {
                  return Redirect::to('account')->with('alert-success', 'You are now logged in.'); 

                $errors = new MessageBag(['password' => ['Email and/or password invalid.']]); 

                return Redirect::back()->withErrors($errors)->withInput(Input::except('password')); 
              }

        }

这是我的路线

Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');

Route::get('customchecker','LoginController@customchecker')->name('customchecker');

但我收到错误,这是我的错误

  

Symfony \ Component \ HttpKernel \ Exception \   MethodNotAllowedHttpException   没有消息

所以,我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

您的customchecker路由被声明为GET,请确保您使用相同的操作,而不是POST或其他。

相关问题