Php Laravel默认身份验证-添加字段会破坏登录功能

Php Laravel默认身份验证-添加字段会破坏登录功能,php,mysql,laravel,laravel-5.2,Php,Mysql,Laravel,Laravel 5.2,我被默认的Laravel身份验证卡住了。我通过php artisan make:auth生成了它 “我的用户”表需要的字段比默认值提供的字段多。这是我的表迁移 use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateUsersTable extends Migration { public function up() {

我被默认的Laravel身份验证卡住了。我通过php artisan make:auth
生成了它

“我的用户”表需要的字段比默认值提供的字段多。这是我的表迁移

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('first', 20)->nullable();
            $table->string('last', 20)->nullable();
            $table->string('email', 50)->unique();
            $table->string('password', 20);
            $table->integer('userRoleId')->unsigned()->index();
            $table->integer('userGroupId')->unsigned()->index();
            $table->integer('companyId')->unsigned()->index();
            $table->rememberToken();
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::drop('users');
    }
}
然后我编辑了
User.php
模型并更新了
$filleble
字段

namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    protected $fillable = [
        'first', 'last', 'email', 'password', 'userRoleId', 'userGroupId', 'companyId',
    ];

    protected $hidden = [
        'password', 'remember_token',
    ];
}
当我提交表单时,它会正确地发布到数据库并被存储。我能看见那一排

问题是,现在当我创建新用户后退出并返回到登录并填写表单时,它返回错误,指出我输入的电子邮件地址与任何记录都不匹配,即使数据库中显然有一行具有相同的数据和相同的列名


我做错了什么?

@阿尔法在评论中的回答解决了我的问题

我的过程是正确的,只是我没有考虑到密码是散列的,并且没有为数据库字段中的散列提供足够的字符


$table->string('password',20)需要更改为
$table->string('password',60)

假设您使用的是哈希密码。更改
$table->string('password',20)
$table->string('password',60)这就解决了它!我没有为密码哈希允许足够的字符。