Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.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
使用laravel 5.4在数据库中存储注册数据_Laravel - Fatal编程技术网

使用laravel 5.4在数据库中存储注册数据

使用laravel 5.4在数据库中存储注册数据,laravel,Laravel,一直在尝试在laracast视频之后创建用户注册/登录页面 但是当我尝试注册一个用户时,它会返回到同一个页面,而不会给出任何关于原因的错误。我还注意到提供的信息没有存储在数据库中 我很困惑我不知道我做错了什么你的帮助会很感激的 以下是我的看法: <div class="col-md-offset-1 col-md-8"> <h1 class="text-center ">Register</h1> <form method="POST"

一直在尝试在laracast视频之后创建用户注册/登录页面

但是当我尝试注册一个用户时,它会返回到同一个页面,而不会给出任何关于原因的错误。我还注意到提供的信息没有存储在数据库中

我很困惑我不知道我做错了什么你的帮助会很感激的

以下是我的看法:

<div class="col-md-offset-1 col-md-8">
    <h1 class="text-center ">Register</h1>
    <form method="POST" action="register"  enctype="multipart/form-data">
        {{ csrf_field() }}
        <div class="form-group">
            <label for="name">Name</label>
            <input type="text" class="form-control" name="name" required>
         </div>
        <div class="form-group">
            <label for="email">Email</label>
            <input type="email" class="form-control" email="email" required>
        </div>
        <div class="form-group">
            <label for="password">Password</label>
            <input type="password" class="form-control" name="password" required>
        </div>
        <div class="form-group">
            <label for="password_confirmation">Password Confirmation</label>
            <input type="password" class="form-control" name="password_confirmation" required>
        </div>
        <button type="submit" class="btn btn-primary"><i class="fa fa-reply"></i>Register</button>
    </form>
</div>
这是我的路由文件:

Route::get('register', 'RegistrationController@create');
Route::post('register', 'RegistrationController@store');

提前非常感谢

检查您的表单,电子邮件字段中有一个错误。它说:

应该是:

<input type="email" class="form-control" name="email" required>


因此,在添加此错误块之前,先将电子邮件=“email”替换为名称=“email”

。因此,您可以很容易地发现错误

@if ($errors->any())
<div class="alert alert-danger">
    <ul>
        @foreach ($errors->all() as $error)
            <li>{{ $error }}</li>
        @endforeach
    </ul>
</div>
@endif
@if($errors->any())
    @foreach($errors->all()作为$error)
  • {{$error}}
  • @endforeach
@恩迪夫
那么,你的错误就在于形式行动。请将其替换为以下代码

<form method="POST" action="{{ route('register') }}"  enctype="multipart/form-data">


可能未通过验证规则。最有可能的地方是
'password'=>'required | confirm',
您能否尝试检查验证是否失败<代码>如果($validate->fails())//显示错误这就是问题所在。非常感谢你的帮助。
<form method="POST" action="{{ route('register') }}"  enctype="multipart/form-data">