2016-09-21 82 views
3

這是使用ADLDAP &我只是做了一些工作,Laravel,所以我越來越困惑我的第一次。ADLDAP2爲Laravel 5.2 - 綁定用戶建模

在配置文件中的Notes這樣說:

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

我的問題是在哪裏/我怎麼添加Adldap\Laravel\Traits\AdldapUserModelTrait特質在config/auth.php文件?

回答

2

你不使用它,你的身份驗證的配置文件中。但是,您可以將其導入到用戶模型中。所以

use Adldap\Laravel\Traits\AdldapUserModelTrait; 

class User extends Authenticatable { 
    use AdldapUserModelTrait; 
} 
+0

更有意義。這是'插入特徵...到您在config/auth.php中配置的用戶模型'的評論中的措辭,使我感到困惑。謝謝! – TH1981

+1

Adldap2的作者在這裏。我會改變措辭使其更清晰,謝謝你的建議! –