Laravel Cartalyst Sentinel - Adding a username column to users table (What is the right way)

后端 未结 1 1430
栀梦
栀梦 2020-12-16 03:30

I\'ve pulled in cartalyst/sentinel and i\'ve run the migrations required to generate the tables

php artisan migrate --package=cartalyst/sentinel
相关标签:
1条回答
  • 2020-12-16 03:49

    Almost. You have to create your own User clas, extending vendor/cartalyst/sentinel/src/Users/EloquentUser.php:

    use Cartalyst\Sentinel\Users\EloquentUser as CartalystUser;
    
    class User extends CartalystUser {
    
        protected $fillable = [
            'email',
            'username', /* i added this */
            'password',
            'last_name',
            'first_name',
            'permissions',
        ];
    
    }
    

    Publish Sentinel's config:

    php artisan config:publish cartalyst/sentinel
    

    And in the config file, set the user model to your own:

    'users' => [
    
        'model' => 'Your\Namespace\User',
    
    ],
    
    0 讨论(0)
提交回复
热议问题