我是laravel的新手,正在laravel做我的最后一个项目,但是今天当我在填写注册表时,我只是遇到了麻烦,我的浏览器没有给出任何错误,但是我的数据库也不接受我不做的任何事情不知道为什么会发生,请帮助我。
这是我的注册表格
ReferenceError: Can't find variable: text
这是控制器
@extends('layouts.app')
@section('content')
<div class="container signup-form">
<div class="row justify-content-center">
<div class="col-md-8">
<h4 class="mb-5 display-4 font-weight-bold signup-h4 ">{{ __('Signup') }}
</h4>
<div class="card-body">
<form method="POST" action="{{ route('register') }}">
@csrf
<div class="form-group row">
<label for="name" class="col-md-4 col-form-label text-md-right">{{
__('Name') }}</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control{{ $errors->has('name') ? '
is-invalid' : '' }}" name="name" value="{{ old('name') }}" required
autofocus>
@if ($errors->has('name'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('name') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-
Mail Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" required>
@if ($errors->has('email'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{
__('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control{{ $errors-
>has('password') ? ' is-invalid' : '' }}" name="password" required>
@if ($errors->has('password'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group row">
<label for="password-confirm" class="col-md-4 col-form-label text-md-right">
{{ __('Confirm Password') }}</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control"
name="password_confirmation" required>
</div>
</div>
<div class="form-group row">
<label for="weight" class="col-md-4 col-form-label text-md-right">
{{ __('Weight') }} <span class="text-muted">(Kg)</span> </label>
<div class="col-md-6">
<input type="text" name="weight" class="form-control {{ $errors-
>has('weight') ? ' is-invalid' : '' }}" id="weight" placeholder=""
required/>
@if ($errors->has('weight'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('weight') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group row">
<label for="height" class="col-md-4 col-form-label text-md-right">
{{ __('height') }} <span class="text-muted">(foot)</span> </label>
<div class="col-md-6">
<input type="text" name="height" class="form-control {{ $errors-
>has('height') ? ' is-invalid' : '' }}" id="height" placeholder=""
required/>
@if ($errors->has('height'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('height') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group row">
<label for="gander" class="col-md-4 col-form-label
text-md-right">
{{ __('Gender') }} </label>
<div class="col-md-6">
<div class="form-check">
<label class="form-check-label col-md-2">
<input type="radio" name="gender" class="form-
control {{ $errors->has('radio') ? ' is-invalid' : '' }}" id="maleradio"
placeholder="" required/>{{ __('Male') }}
</label>
<label class="form-check-label col-md-2">
<input type="radio" name="gender" class="form-
control {{ $errors->has('radio') ? ' is-invalid' : '' }}" id="femaleradio"
placeholder="" required/>{{ __('Female') }}
</label>
@if ($errors->has('radio'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('radio') }}
</strong>
</span>
@endif
</div>
</div>
</div>
<div class="form-group row">
<label for="dob" class="col-md-4 col-form-label
text-md-right">
{{ __('DOB') }}</label>
<div class="col-md-6 input-group input-group-sm col-4 m-
0 ">
<input type="date" name="date" style="width:
200px;" class="form-control {{ $errors->has('date') ? ' is-invalid' : '' }}"
id="date" placeholder="" required/>
@if ($errors->has('date'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('date') }}
</strong>
</span>
@endif
</div>
</div>
<div class="form-group row mb-3">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary nav-button">
{{ __('Register') }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
@endsection
}
这是user.php代码
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
'weight' => 'required|string|max:5',
'height' => 'required|string|max:5',
'gender'=> 'required|in:male,female',
'dob' => 'required',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
'weight' => $data['weight'],
'height' => $data['height'],
'gender'=> $data['gender'],
'dob' => $data['dob'],
]);
}