protected function discoverAdldapFromModel($model)
{
if ($this->getBindUserToModel() && $model) {
// If the developer wants to bind the Adldap User model
// to the Laravel model, we'll query to find it.
$attributes = $this->getUsernameAttribute();
$key = key($attributes);
$user = $this->newAdldapUserQuery()->where([$attributes[$key] => $model->{$key}])->first();
if ($user instanceof User) {
$model = $this->bindAdldapToModel($user, $model);
}
}
return $model;
}