2

I've so trouble adding columns to users table with Sentinel.

What I did :

  • Creating my own migration file to add (for now) 1 column : "adress"
  • Creating a class "User" in app/Http/Controller

    namespace App\Http\Controllers;


    use Cartalyst\Sentinel\Users\EloquentUser;

    class User extends EloquentUser {

        protected $fillable = [
            'email',
            'password',
            'last_name',
            'first_name',
            'permissions',
            'adresse',
        ];


    }
  • Changing the model in config/cartalyst.sentinel.php

    'model' => 'Cartalyst\Sentinel\Users\EloquentUser',
    

    to

    'model' => 'App\Http\Controllers\User',
    

But, adresse stay empty in database.

I've tried my code with

     $credentials = [
            'email'    => 'john.dode@example.com',
            'password' => 'password',
            'adresse' => 'password',
        ];

        $user = Sentinel::create($credentials);
        dd($user);

And the result of dd($user) is :

EloquentUser {#392 ▼


 #table: "users"
  #fillable: array:5 [▼
    0 => "email"
    1 => "password"
    2 => "last_name"
    3 => "first_name"
    4 => "permissions"
  ]
  [...]

I don't want to add my fields in the vendors, but it's the only solutions working right now ...

Edit : I've tried to follow EXACTLY this https://github.com/cartalyst/sentinel/wiki/Extending-Sentinel but same result here ...

UPDATE

My problem seem to be deeper than expected ... If I change \vendor\cartalyst\sentinel\src\config\config.php it's working pretty well. So my config/cartalyst.sentinel.php is completly ignore by Sentinel ...

Thanks guys !

4

2 回答 2

1

这可能会有所帮助:php artisan config:cache

于 2016-10-13T16:45:05.843 回答
-1

好的...所以,由于Laravel Sentinel 引用了错误的配置文件,我发现了问题所在

我正在使用

use Cartalyst\Sentinel\Native\Facades\Sentinel;

代替

use Sentinel;

所以,我只是跟着医生……干得好!

于 2015-12-14T00:53:12.493 回答