我尝试在注册表中添加无线电。当有人想要注册时,他需要选择它是男人还是女人,当我试图注册它不工作,不保存在数据库中,什么也没发生
,有人可以帮助我添加选择男人或女人的收音机。当我想要注册时,什么也没有发生,无论是在数据库中还是在页面上
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateUsersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('users', function (Blueprint $table) { $table->id(); $table->string('firstname'); $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); $table->string('name'); $table->date('created_at'); $table->string('address'); $table->string('city'); $table->string('zipcode'); $table->string('gender'); $table->string('number')->unique(); $table->date('birthday'); $table->string('pseudo')->unique(); $table->rememberToken(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('users'); $table->dropColumn('gender'); } }
namespace App; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; class User extends Authenticatable { use Notifiable; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'name', 'birthday', 'email', 'password', 'firstname', 'address', 'city', 'zipcode', 'gender', 'number', 'pseudo', ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', ]; }
namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use App\Providers\RouteServiceProvider; use App\User; use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; class RegisterController extends Controller { /* |-------------------------------------------------------------------------- | Register Controller |-------------------------------------------------------------------------- | | This controller handles the registration of new users as well as their | validation and creation. By default this controller uses a trait to | provide this functionality without requiring any additional code. | */ use RegistersUsers; /** * Where to redirect users after registration. * * @var string */ protected $redirectTo = RouteServiceProvider::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'], 'firstname' => ['required', 'string', 'max:255'], 'address' => ['required', 'string', 'min:8'], 'city' => ['required', 'string', 'min:8'], 'zipcode' => ['required', 'string', 'min:2'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'birthday' => ['required', 'date_format:Y-m-d', 'before:today'], 'password' => ['required', 'string', 'min:8', 'confirmed'], 'pseudo' => ['required', 'string', 'min:8', 'unique:users'], 'number' => ['required', 'string', 'min:8', 'unique:users'], 'gender' => ['required', 'string'], ]); } /** * 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'], 'firstname' => $data['firstname'], 'address' => $data['address'], 'zipcode' => $data['zipcode'], 'email' => $data['email'], 'birthday' => $data['birthday'], 'city' => $data['city'], 'number' => $data['number'], 'gender' => $data['gender'], 'pseudo' => $data['pseudo'], 'password' => Hash::make($data['password']), ]); } }
寄存器刀片php
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Register') }}</div>
<div class="card-body">
<form method="POST" action="{{ route('register') }}">
@csrf
<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 @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</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 @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</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 autocomplete="new-password">
</div>
</div>
<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 @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
@error('name')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="firstname" class="col-md-4 col-form-label text-md-right">{{ __('Firstname') }}</label>
<div class="col-md-6">
<input id="firstname" type="text" class="form-control @error('firstname') is-invalid @enderror" name="firstname" value="{{ old('firstname') }}" required autocomplete="firstname" autofocus>
@error('firstname')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="address" class="col-md-4 col-form-label text-md-right">{{ __('address') }}</label>
<div class="col-md-6">
<input id="address" type="text" class="form-control @error('address') is-invalid @enderror" name="address" value="{{ old('address') }}" required autocomplete="address" autofocus>
@error('address')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="city" class="col-md-4 col-form-label text-md-right">{{ __('city') }}</label>
<div class="col-md-6">
<input id="city" type="text" class="form-control @error('city') is-invalid @enderror" name="city" value="{{ old('city') }}" required autocomplete="city" autofocus>
@error('city')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="zipcode" class="col-md-4 col-form-label text-md-right">{{ __('zipcode') }}</label>
<div class="col-md-6">
<input id="zipcode" type="text" class="form-control @error('zipcode') is-invalid @enderror" name="zipcode" value="{{ old('zipcode') }}" required autocomplete="zipcode" autofocus>
@error('zipcode')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="number" class="col-md-4 col-form-label text-md-right">{{ __('number') }}</label>
<div class="col-md-6">
<input id="number" type="text" class="form-control @error('number') is-invalid @enderror" name="number" value="{{ old('number') }}" required autocomplete="number" autofocus>
@error('number')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="birthday" class="col-md-4 col-form-label text-md-right">{{ __('birthday') }}</label>
<div class="col-md-6">
<input id="birthday" type="date" class="form-control @error('birthday') is-invalid @enderror" name="birthday" value="{{ old('birthday') }}" required autocomplete="birthday" autofocus>
@error('birthday')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<div id="gender-group" class="form-group{{ $errors->has('gender') ? ' has-error' : '' }}">
<label for="gender" class="col-md-4 col-form-label text-md-right">{{ __('Gender') }}</label>
<div class="col-md-6">
<div><input id="female" type="radio" class="form-control" name="gender" value="Female"> {{ (old('sex') == 'female') ? 'checked' : '' }} >Female</div>
<div><input id="male" type="radio" class="form-control" name="gender" value="Male"> {{ (old('sex') == 'male') ? 'checked' : '' }} >Male</div>
@error('gender')
<span class="help-block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
<div class="form-group row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Register') }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
use Illuminate\Support\Facades\Route; /* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | contains the "web" middleware group. Now create something great! | */ Route::view('/', 'pages.home'); Auth::routes(); Route::get('/home', 'HomeController@index')->name('home');
有人能说说我的错误在哪里?
我首先看到的是您的字段名为“gender”,您正在调用old('sex')
之后,您正在创建一个新用户,但您没有重定向到任何地方,导致这个“空白”屏幕。据我所知,在您的路由文件中没有“注册”路由
问题内容: 请考虑以下示例: 输出为:,并且省略号不出现。 我在这里想念什么? 问题答案: 显然,添加: 也解决了这个问题。 另一种可能的解决方案是为表格设置,也将其设置为。
问题内容: 我们在其他语言中认为是理所当然的,并且几乎期望它可以继续工作,但不会起作用-这样做是如此自然,所以为什么编译器不满意?只是有时候感觉就像不耐烦。 递增值的唯一方法是将其放在单独的行中? http://play.golang.org/p/_UnpZVSN9n 问题答案: 而在golang声明,不表达
问题内容: 为什么这项工作有效- 但这不是- 第二种情况下的输出为。你能解释一下输出吗? 问题答案: 该方法没有返回值。它会在适当的位置更改列表,并且由于您没有将分配给任何变量,因此只是“迷失在空间” 我没有重载所有有问题的方法,但是概念应该很清楚。
我试图在我的Word文档中使用块,但我有一些问题。首先,当我在我的文档中声明一个块时,如果我不使用函数“cloneBlock”,结果会出现这样的情况: 也许我必须使用那个函数才能正常出现。但是我的主要问题是“删除块”不起作用。如果我不克隆块,生成的docx就会损坏。但是如果我克隆了这个块,函数“删除块”不会删除这个块,它会在我的最终docx文件中显示那个块内的信息。 这是我的代码: Docx模板:
问题内容: 我的Dockerfile创建一个目录,将其chown,然后再列出该目录。该目录仍归root用户所有。这是为什么? 这是Dockerfile: 这是“ docker build”的输出: Docker版本1.2.0,构建fa7b24f 主机运行Ubuntu 12.04,但具有3.13.0-36通用内核。 问题答案: 回答我自己的问题:它声明为卷。如果取出VOLUME指令,则将生效。 此外
问题内容: 我想在控制台中打印一些内容,以便对其进行调试。但是由于某种原因,我的Android应用程序中没有任何内容。 那我该如何调试呢? 问题答案: 在仿真器上,大多数设备都重定向到LogCat并使用进行打印。在非常旧的或自定义的Android版本上可能并非如此。 原版的: 没有控制台将消息发送到,因此消息丢失。当你使用来运行“传统” Java应用程序时,也会以同样的方式发生这种情况。 相反,你