📜  将验证错误 laravel 重定向到特定部分 laravel - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:28.400000             🧑  作者: Mango

代码示例1
$validator = Validator::make($request->all(), [
  'name' => 'required',
]);

if ($validator->fails()) {
  return redirect()->to(url()->previous() . '#section')->withErrors($validator)->withInput();
}