ADLDAP2 for Laravel 5.2 -绑定用户到模型



这是我第一次使用ADLDAP &我只做过一些Laravel的工作,所以我有点困惑。

配置文件中的注释是这样说的:

    /*
|--------------------------------------------------------------------------
| Bind User to Model
|--------------------------------------------------------------------------
|
| The bind user to model option allows you to access the Adldap user model
| instance on your laravel database model to be able run operations
| or retrieve extra attributes on the Adldap user model instance.
|
| If this option is true, you must insert the trait:
|
|   `AdldapLaravelTraitsAdldapUserModelTrait`
|
| Onto your User model configured in `config/auth.php`.
|
| Then use `Auth::user()->adldapUser` to access.
|
| This option must be true or false.
|
*/

我的问题是我在哪里/如何在配置/auth.php文件中添加AdldapLaravelTraitsAdldapUserModelTrait特征?

不能在授权配置文件中使用它。但你要在用户模型中导入它。所以

use AdldapLaravelTraitsAdldapUserModelTrait;
class User extends Authenticatable {
    use AdldapUserModelTrait;
}

最新更新