/**
* Retrieve a user by their unique identifier.
*
* @param mixed $identifier
* @return \Illuminate\Auth\UserInterface|null
*/
public function retrieveById($identifier)
{
if ($entries = $this->searchLdap($identifier)) {
if (Config::get('l4-openldap::use_db')) {
$ldap_value = $entries[0][Config::get('l4-openldap::ldap_field')][0];
$user = $this->db_conn->table(Config::get('l4-openldap::db_table'))->where(Config::get('l4-openldap::db_field'), '=', $ldap_value)->first();
if (Config::get('l4-openldap::eloquent')) {
return $this->createModel()->newQuery()->find($user->id);
} else {
return new GenericUser(get_object_vars($user));
}
} else {
return $this->createGenericUserFromLdap($entries[0]);
}
}
}