Adldap\Laravel\Traits\ImportsUsers::handleAttributeRetrieval PHP Method

handleAttributeRetrieval() protected method

Handles retrieving the specified field from the User model.
protected handleAttributeRetrieval ( User $user, string $field ) : string | null
$user Adldap\Models\User
$field string
return string | null
    protected function handleAttributeRetrieval(User $user, $field)
    {
        if ($field === $this->getSchema()->thumbnail()) {
            // If the field we're retrieving is the users thumbnail photo, we need
            // to retrieve it encoded so we're able to save it to the database.
            $value = $user->getThumbnailEncoded();
        } else {
            $value = $user->{$field};
            // If the AD Value is an array, we'll
            // retrieve the first value.
            $value = is_array($value) ? array_get($value, 0) : $value;
        }
        return $value;
    }