$validator = Validator::make($request->all(), [ 'name' => 'required', ]); if ($validator->fails()) { return redirect()->to(url()->previous() . '#section')->withErrors($validator)->withInput(); }