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

syncModelPassword() protected method

Syncs the models password with the specified password.
protected syncModelPassword ( Model $model, string $password ) : Model
$model Illuminate\Database\Eloquent\Model
$password string
return Illuminate\Database\Eloquent\Model
    protected function syncModelPassword(Model $model, $password)
    {
        // If the developer doesn't want to synchronize AD passwords,
        // we'll set the password to a random 16 character string.
        $password = $this->getPasswordSync() ? $password : str_random();
        // If the model has a set mutator for the password then
        // we'll assume that the dev is using their own
        // encryption method for passwords. Otherwise
        // we'll bcrypt it normally.
        $model->password = $model->hasSetMutator('password') ? $password : bcrypt($password);
        return $model;
    }