#1067 - ' remember_token'的默认值无效

时间:2014-10-12 19:27:10

标签: mysql laravel phpmyadmin

在Lynda教程" Up and Running with Laravel"中,创建了一个示例应用程序(authapp),允许用户登录。

以下是create_user迁移的结构:

public function up()
    {
        Schema::create('users', function($newtable)
        {
            $newtable->increments('id');
            $newtable->string('email')->unique();
            $newtable->string('username',100)->unique();
            $newtable->string('password',50);
            $newtable->string('remember_token',100);
            $newtable->timestamps();
        });
    }

这是相应的视图文件摘录:

{{ Form::open(array('url'=>'register')) }}
        {{ Form::label('email', 'Email Address') }}
        {{ Form::text('email') }}

        {{ Form::label('username', 'Username') }}
        {{ Form::text('username') }}

        {{ Form::label('password', 'Password') }}
        {{ Form::password('password') }}

        {{ Form::submit('Sign Up')}}

      {{ Form::close() }}

当所有内容都保存完毕并且我尝试在实际应用中注册时,我收到错误:教程说它是因为没有为remember_token变量设置默认值并建议转到phpMyAdmin将默认值设置为NULL。

但是,当我这样做时,收到以下错误消息:

phpMyAdmin print screen

因此,我无法修复错误并继续。

关于如何处理这种情况的任何想法?

2 个答案:

答案 0 :(得分:1)

在phpMyAdmin中,您还需要检查Null复选框,以便在此字段中允许空值。

屏幕截图右侧几乎没有截止。

答案 1 :(得分:0)

我只能看到未选中Null复选框。通过选中Null复选框将字段设置为可为空。

相关问题