Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

dynamic switch Provider DatabaseUserProvider / NoDatabaseUserProvider #884

Open
phunsanit opened this issue Jul 30, 2020 · 0 comments
Open

Comments

@phunsanit
Copy link

  • 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();

}
`

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant