public function import(array $users = []) : int
    {
        $imported = 0;

        $this->output->progressStart(count($users));

        foreach ($users as $user) {
            try {
                // Import the user and retrieve it's model.
                $model = Bus::dispatch(
                    new ImportUser($user, $this->model())
                );

                // Set the users password.
                Bus::dispatch(new SyncPassword($model));

                // Save the returned model.
                $this->save($user, $model);

                if ($this->isDeleting()) {
                    $this->delete($user, $model);
                }

                if ($this->isRestoring()) {
                    $this->restore($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;
    }
public function import(array $users = []) : int
    {
        $imported = 0;

        $this->output->progressStart(count($users));

        foreach ($users as $user) {
            try {
                // Import the user and retrieve it's model.
                $model = Bus::dispatch(
                    new ImportUser($user, $this->model())
                );

                // Set the users password.
                Bus::dispatch(new SyncPassword($model));

                // Save the returned model.
                $this->save($user, $model);

                if ($this->isDeleting()) {
                    $this->delete($user, $model);
                }

                if ($this->isRestoring()) {
                    $this->restore($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;
    }
public function import ( array $ users = [ ] ) : int { $ imported = 0 ; $ this -> output -> progressStart ( count ( $ users ) ) ; foreach ( $ users as $ user ) { try { // Import the user and retrieve it's model. $ model = Bus :: dispatch ( new ImportUser ( $ user , $ this -> model ( ) ) ) ; // Set the users password. Bus :: dispatch ( new SyncPassword ( $ model ) ) ; // Save the returned model. $ this -> save ( $ user , $ model ) ; if ( $ this -> isDeleting ( ) ) { $ this -> delete ( $ user , $ model ) ; } if ( $ this -> isRestoring ( ) ) { $ this -> restore ( $ 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 ; }
Imports the specified users and returns the total
number of users successfully imported.

@param array $users

@return int
Imports the specified users and returns the total number of users successfully imported .