Adldap\Laravel\Auth\DatabaseUserProvider::discoverAdldapFromModel PHP Method

discoverAdldapFromModel() protected method

Retrieves the Adldap User model from the specified Laravel model.
protected discoverAdldapFromModel ( mixed $model ) : null | Illuminate\Contracts\Auth\Authenticatable
$model mixed
return null | Illuminate\Contracts\Auth\Authenticatable
    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;
    }