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

时间:2016-09-21 15:39:29

标签: php laravel-5 adldap

这是我第一次使用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.
|
*/

我的问题是在config / auth.php文件中我在哪里/如何添加Adldap\Laravel\Traits\AdldapUserModelTrait特征?

1 个答案:

答案 0 :(得分:2)

您不在auth配置文件中使用它。但是您可以在用户模型中导入它。所以

use Adldap\Laravel\Traits\AdldapUserModelTrait;

class User extends Authenticatable {
    use AdldapUserModelTrait;
}