i'm trying to create a custom check with laravel. I adding this in 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'));
}
}
and here is my route
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::get('customchecker','LoginController@customchecker')->name('customchecker');
But i get an error , here is my error
Symfony \\ Component \\ HttpKernel \\ Exception \\ MethodNotAllowedHttpException No message
so, how can i fix this ?
您的customchecker
路由声明为GET
,请确保您使用相同的操作而不是POST
或其他内容。
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.