I'm stuck with the default Laravel Auth. I generated it through php artisan make:auth
.
My User table requires more fields than the default provides. Here is my migration for the table.
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');
}
}
I then edited the User.php
Model and updated the $fillable
fields.
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',
];
}
When I submit the form it posts properly to the database and is stored. I can see the row.
The problem is that now when I logout after creating a new user and return to login and fill out the form, it returns with errors stating that the email address I entered does not match any records even though there clearly is a row with the same data and same column name in the database.
What am I doing wrong?