Adldap2/Adldap2-Laravel

dynamic switch Provider DatabaseUserProvider / NoDatabaseUserProvider

phunsanit opened this issue · 0 comments

  • Laravel Version: 6.18
  • Adldap2-Laravel Version: 6.0
  • PHP Version: 7.3.9
  • LDAP Type: ActiveDirectory

may i switch Provider ( DatabaseUserProvider / NoDatabaseUserProvider ) by condition if have user in users table

`if(User::find(2)){
$Provider = DatabaseUserProvider;
}else {
$Provider = NoDatabaseUserProvider;
}

if (Auth::attempt($credentials)) {
$user = Auth::user();

var_dump($user); // Returns instance of App\User;

var_dump($user->ldap); // Returns instance of Adldap\Models\User;

// Examples:

$user->ldap->getGroups();

$user->ldap->getCommonName();

$user->ldap->getConvertedSid();

}
`