简体   繁体   English

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

[英]ADLDAP2 for Laravel 5.2 - Binding user to model

This is my first time using ADLDAP & I've only done some Laravel work, so I'm getting confused. 这是我第一次使用ADLDAP并且我只完成了一些Laravel工作,所以我感到很困惑。

The notes in the config file say this: 配置文件中的注释说明:

    /*
|--------------------------------------------------------------------------
| 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.
|
*/

My question is where/how do I add the Adldap\\Laravel\\Traits\\AdldapUserModelTrait trait in the config/auth.php file? 我的问题是在config / auth.php文件中我在哪里/如何添加Adldap\\Laravel\\Traits\\AdldapUserModelTrait特征?

You don't use it inside your auth configuration file. 您不在auth配置文件中使用它。 But you import it in your user model. 但是您可以在用户模型中导入它。 So 所以

use Adldap\Laravel\Traits\AdldapUserModelTrait;

class User extends Authenticatable {
    use AdldapUserModelTrait;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM