Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using cartalyst-sentinel registerAndActivate methods how extend fields list? #538

Open
sergeynilov opened this issue Sep 7, 2020 · 0 comments

Comments

@sergeynilov
Copy link

Hallo,
My laravel 7 app has login /register functionality and I added to my project
cartalyst-sentinel 4.x
and replacing my code with cartalyst-sentinel methods I got error

Field 'username' doesn't have a default value (SQL: insert into hs3_users (email, password, updated_at, created_at) values ([email protected], $2y$10$TBUJVFfOT1uc7tw3o2dajOd27kpPP5zYQSdf7ifKf7m10IkXgtko2, 2020-09-06 16:28:53, 2020-09-06 16:28:53))
making :

                $newUser = Sentinel::registerAndActivate([
                    'username' => $this->form['username'],
                    'email'    => $this->form['email'],
                    'password' => $this->form['password']
                ]);

I modified migration file from cartalyst-sentinel and added several fields, incuding username.
My model app/User.php has :

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;

use App\UsersGroups;
use App\Group;

class User extends Authenticatable 
{
    use Notifiable;
    protected $table = 'users';
    protected $primaryKey = 'id';
    public $timestamps = false;

    protected $fillable = [
        'username', 'email', 'password', 'status', 'account_type', 'first_name', 'last_name', 'phone', 'creator_id', 'avatar'
        ...

I found files vendor/cartalyst/sentinel/src/Users/EloquentUser.php and
/vendor/cartalyst/sentinel/src/Users/UserInterface.php
Have I to reference my model to one of these 2 files? In which way?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant