Laravel 5.2 的 ADLDAP2 - 将用户绑定到模型

ADLDAP2 for Laravel 5.2 - Binding user to model

这是我第一次使用 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:
|
|   `Adldap\Laravel\Traits\AdldapUserModelTrait`
|
| Onto your User model configured in `config/auth.php`.
|
| Then use `Auth::user()->adldapUser` to access.
|
| This option must be true or false.
|
*/

我的问题是 where/how 我是否要在 config/auth.php 文件中添加 Adldap\Laravel\Traits\AdldapUserModelTrait 特征?

您没有在您的授权配置文件中使用它。但是你将它导入到你的用户模型中。所以

use Adldap\Laravel\Traits\AdldapUserModelTrait;

class User extends Authenticatable {
    use AdldapUserModelTrait;
}