Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel 5.5,验证后无法通过数据_Php_Laravel 5.5 - Fatal编程技术网

Php Laravel 5.5,验证后无法通过数据

Php Laravel 5.5,验证后无法通过数据,php,laravel-5.5,Php,Laravel 5.5,我对注册新用户进行了验证,但每次提交时都只是重新加载并停留在页面中,我会迷失方向,但是当我使用Registration::create($request->all())时,如果没有从顶部进行验证,它会推送并保存数据。请帮忙 我的控制器 namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Registration; class RegistrationsCon

我对注册新用户进行了验证,但每次提交时都只是重新加载并停留在页面中,我会迷失方向,但是当我使用Registration::create($request->all())时,如果没有从顶部进行验证,它会推送并保存数据。请帮忙

我的控制器
      namespace App\Http\Controllers;

      use Illuminate\Http\Request;
      use App\Registration;


      class RegistrationsController extends Controller
      {
          public function index(){

              return view('registrations.create');

          }
          public function store(){

              request()->validate([
                  'name' => 'required|string|max:255',
                  'email' => 'required|string|email|max:255|unique:users',
                  'password' => 'required|string|min:6|confirmed',
              ]);

              $validatedUser = Registration::create([
                  'name' => request('name'),
                  'email' => request('email'),
                  'password' => bcrypt(request('password'))
              ]);

              return redirect()->home();

          }
      }
这是我的创造之刃

             <form action="{{ route('registrations.store') }}" method="POST">

                         {{ csrf_field() }}

                              <div class="form-group">
                                <label for="">Full Name</label>
                                <input type="text" class="form-control" name="name" id="name" aria-describedby="helpId" placeholder="Juan Dela Cruz">
                                <small id="helpId" class="form-text text-muted">Ex. Juan Dela Cruz</small>
                              </div>

                              <div class="form-group">
                                <label for="">Password</label>
                                <input type="password" class="form-control" name="password" id="password" placeholder="type password here..">
                              </div>

                              <div class="form-group">
                                <label for="">Confirm password</label>
                                <input type="password" class="form-control" name="password_confirm" id="password_confirm" placeholder="type password here..">
                              </div>

                              <div class="form-group">
                                <label for="">Email address</label>
                                <input type="email" class="form-control" name="email" id="email" aria-describedby="emailHelpId" placeholder="juandelacruz@gmail.com">
                                <small id="emailHelpId" class="form-text text-muted">Must be valid email address</small>
                              </div>

                              <button type="submit" class="btn btn-primary">Submit</button>


                     </form>

{{csrf_field()}}
全名
前胡安·德拉·克鲁兹
密码
确认密码
电子邮件地址
必须是有效的电子邮件地址
提交
对于我的路线,我只使用了route::resource


谢谢

这可能是因为密码确认失败。 您的确认字段必须命名为:
password\u confirmation
,而不是
password\u confirmation
,如文档所述:

验证中的字段必须具有foo_confirmation的匹配字段。例如,如果要验证的字段是password,则输入中必须存在匹配的password\u confirmation字段


这可能是因为您的密码确认失败。 您的确认字段必须命名为:
password\u confirmation
,而不是
password\u confirmation
,如文档所述:

验证中的字段必须具有foo_confirmation的匹配字段。例如,如果要验证的字段是password,则输入中必须存在匹配的password\u confirmation字段


正在创建用户吗?我也不熟悉
home()
,也找不到任何相关文档,所以您是否尝试过
redirect()->route('home')
(或者调用任何路由)?是否创建了用户?我也不熟悉
home()
,也找不到相关文档,所以您是否尝试过
redirect()->route('home')
(或任何称为路由的方法)?嗯。。成功了!lol不知道这一点,因为当我使用5.4密码时,确认工作正常。谢谢你,伙计!不客气。请将答案标记为“已回答”,以便其他人可以轻松找到它。。成功了!lol不知道这一点,因为当我使用5.4密码时,确认工作正常。谢谢你,伙计!不客气。请标记为已回答,以便其他人可以轻松找到。