我尝试从.../app/Http/Controllers/Auth/ResetPasswordController.php
中的验证中捕获错误消息:
public function reset(Request $request)
{
$this->validate($request, $this->rules(), $this->validationErrorMessages());
$response = $this->broker()->reset(
$this->credentials($request), function ($user, $password) {
$this->resetPassword($user, $password);
}
);
return $response == Password::PASSWORD_RESET
? $this->sendResetResponse($response)
: $this->sendResetFailedResponse($request, $response);
}
但如果会话中的验证失败,则没有错误。
在:
public function validate(Request $request, array $rules, array $messages = [], array $customAttributes = [])
{
$validator = $this->getValidationFactory()->make($request->all(), $rules, $messages, $customAttributes);
if ($validator->fails()) {
$this->throwValidationException($request, $validator);
}
}
抛出异常,但我不知道如何在会话中使用它。
但如果我在$validator->errors()->getMessages()
中检查protected function formatValidationErrors(Validator $validator)
,则会出现错误消息:
array:1 [▼
"password" => array:1 [▼
0 => "The password confirmation does not match."
]
]
EDITED
就我而言,问题是在StartSession
中多次使用Kernel.php
。在StartSession
中评论$middleware
后,会话中的闪存效果很好。我不知道它是如何以及何时发生的。
由此:
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Session\Middleware\StartSession::class,
\App\Http\Middleware\LanguageSwitcher::class,
];
到此:
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
//\Illuminate\Session\Middleware\StartSession::class,
\App\Http\Middleware\LanguageSwitcher::class,
];
和
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
(...)
答案 0 :(得分:1)
将此代码用于catch validate errror
SELECT SWITCHOFFSET(SYSDATETIMEOFFSET(), '+05:30')
答案 1 :(得分:0)
请用以下代码替换您的代码:
library(latticeExtra)
c(plot1, plot2, plot3, plot4)