【问题标题】:ADLDAP2 for Laravel 5.2 - Binding user to modelLaravel 5.2 的 ADLDAP2 - 将用户绑定到模型
【发布时间】:2016-09-21 15:39:29
【问题描述】:

这是我第一次使用 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 特征?

【问题讨论】:

    标签: php laravel-5 adldap


    【解决方案1】:

    您不会在身份验证配置文件中使用它。但是您将其导入用户模型中。所以

    use Adldap\Laravel\Traits\AdldapUserModelTrait;
    
    class User extends Authenticatable {
        use AdldapUserModelTrait;
    }
    

    【讨论】:

    • 这更有意义。是insert the trait...Onto your User model configured in config/auth.php 的评论中的措辞让我感到困惑。谢谢!
    • 这里是 Adldap2 的作者。我会更改措辞以使其更清晰,谢谢您的建议!
    猜你喜欢
    • 2016-06-04
    • 2016-08-25
    • 1970-01-01
    • 1970-01-01
    • 2018-01-10
    • 1970-01-01
    • 2018-01-08
    • 2017-01-26
    • 1970-01-01
    相关资源
    最近更新 更多