Good evening. I added a boolean field "privacy_ok" to my user model and migration.
migration file
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('first_name',100)->nullable();
$table->string('last_name',100)->nullable();
$table->string('email');
$table->string('password');
$table->boolean('privacy_ok')->default(0);
$table->text('permissions')->nullable();
$table->timestamp('last_login')->nullable();
$table->timestamps();
$table->engine = 'InnoDB';
$table->unique('email');
});
App\User.php
class User extends Authenticatable
{
use Notifiable;
protected $fillable = [
'first_name','last_name','email', 'password', 'privacy_ok'
];
....
When I try to register my user, the new field is skipped.
$user = Sentinel::register($request->all());
I noticed that, if I cause an error (a duplicate email address... for example), the INSERT query does show the "privacy_ok" field.
Is there a way to solve that?
Do I have to user User::create and than "convert" it into a Cartalyst Sentinel object to go on with all the other operations (such as activation, for example) ?
Thanks
EDIT
I found some info here Laravel Cartalyst Sentinel - Adding a username column to users table (What is the right way)
Now I have a new file App\Models\Cartalyst\User.php, but when I add it to the cartalyst config file ( config/cartalyst.sentinel.php ), I receive an error.
'users' => [
// 'model' => 'Cartalyst\Sentinel\Users\EloquentUser',
'model' => 'App\Models\Cartalyst\User',
],
Cannot declare class User, because the name is already in use
Of course the user is there even if I change User to Lorem. It's not a naming issue.
SOLVED I forgot to declare the namespace in the header of the new class! :(