我有问题在laravel 5.2当我注册一个新的用户与一个表所有记录插入数据库中的表用户但我的remember_token字段始终为空 如果我单击注销将插入remember_token。但我想独自从这种形式 创建多个用户,因为我希望管理员必须创建用户帐户的权利 我想,当我没有注销创建用户帐户每次laravel 5.2创建多用户
控制器
class AuthController extends Controller
{
public function __construct()
{
$this->middleware('guest', ['except' => 'logout']);
}
protected function create(array $data)
{
$user =User::create([
'username' => $data['username'],
'droit'=> $data['droit'],
'idUtilisateur'=> $data['idUtilisateur'],
'password' => bcrypt($data['password']),
]);
return $user;
}
}
为
查看
<form class="form-horizontal" role="form" method="POST" action="{{ url('/register') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('username') ? ' has-error' : '' }}">
<label for="username" class="col-md-4 control-label">Nom d'utilisateur</label>
<div class="col-md-6">
<input id="username" type="text" class="form-control" name="username" value="{{ old('username') }}">
@if ($errors->has('username'))
<span class="help-block">
<strong>{{ $errors->first('username') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">Mot de Passe </label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password">
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
...
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
<i class="fa fa-btn fa-user"></i> Ajouter
</button>
</div>
</div>
</form>
型号
class CreateUsersTable extends Migration
{
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('username')->unique();
$table->string('password');
$table->integer('droit');
$table->integer('idUtilisateur');
$table->integer('EtatCompte');
$table->rememberToken();
$table->timestamps();
});
}
谢谢
为什么你需要rememberToken? – madalinivascu