3

This is my first time using ADLDAP & I've only done some Laravel work, so I'm getting confused.

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?

TH1981
  • 3,105
  • 7
  • 42
  • 78

1 Answers1

2

You don't use it inside your auth configuration file. But you import it in your user model. So

use Adldap\Laravel\Traits\AdldapUserModelTrait;

class User extends Authenticatable {
    use AdldapUserModelTrait;
}
Steve Bauman
  • 8,165
  • 7
  • 40
  • 56
Erik
  • 525
  • 3
  • 8
  • That makes more sense. It was the wording in the comment of `insert the trait...Onto your User model configured in config/auth.php` that confused me. thanks! – TH1981 Sep 21 '16 at 15:46
  • 1
    Author of Adldap2 here. I'll change the wording to make it clearer, thanks for the suggestion! – Steve Bauman Sep 23 '16 at 18:26