0
我試圖做一個重置密碼,我的帖子路線去 - >Laravel重置密碼
public function ResetPassword(Request $request) {
$template_data = [
'template' => $this->template->ConstructArrayTemplate(),
'token' => htmlspecialchars($request->get('token')),
'email' => htmlspecialchars($request->get('email'))
];
$rules = [
'token' => 'required',
'email' => 'required|email',
'password' => 'required|between:6,100|confirmed|passpower'
];
$validator = Validator::make($request->all(), $rules);
$errors = $this->sortErrors ($validator, array('token','email','password'));
if ($errors) {
$template_data [ 'Errs' ] = $errors;
$template_data [ 'template' ] [ 'page_name' ] = 'Reset password';
return view('reset_password', $template_data);
}
$credentials = $request->only('email', 'password', 'password_confirmation', 'token');
$broker = $this->getBroker();
$stats = Password::broker($broker)->reset($credentials, function ($user, $password) {
$this->resetPassword($user, $password);
});
switch ($stats) {
case Password::PASSWORD_RESET:
return rediect('');
default:
return view('404');
}
}
真正的錯誤來自:
$this->resetPassword($user, $password);
ErrorException in AccountSign.php line 109: Argument 1 passed to App\Http\Controllers\AccountSign::ResetPassword() must be an instance of Illuminate\Http\Request, instance of App\User given, called in C:\XAMPP\htdocs\app\Http\Controllers\AccountSign.php on line 137 and defined
我用ResetsPasswords,所以,他有?
的錯誤是很清晰,'resetPassword'方法需要一個'Request'對象,你是在復位功能發送'User'和'$ password' –
檢查特質ResetsPasswords,我也一樣,我應該怎麼辦呢? –