Adldap\Laravel\Commands\Import::import PHP Method

import() public method

Imports the specified users and returns the total number of users successfully imported.
public import ( array $users = [] ) : integer
$users array
return integer
    public function import(array $users = [])
    {
        $imported = 0;
        $this->output->progressStart(count($users));
        foreach ($users as $user) {
            try {
                // Import the user and retrieve it's model.
                $model = $this->getModelFromAdldap($user);
                // Save the returned model.
                $this->save($user, $model);
                if ($this->isDeleting()) {
                    $this->delete($user, $model);
                }
                $imported++;
            } catch (\Exception $e) {
                // Log the unsuccessful import.
                if ($this->isLogging()) {
                    logger()->error("Unable to import user {$user->getCommonName()}. {$e->getMessage()}");
                }
            }
            $this->output->progressAdvance();
        }
        $this->output->progressFinish();
        return $imported;
    }