/** * Syncs the models password with the specified password. * * @param Authenticatable $model * @param string $password * * @return Authenticatable */ protected function syncModelPassword(Authenticatable $model, $password) { if ($model instanceof Model && $model->hasSetMutator('password')) { // 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. $model->password = $password; return $model; } // Always encrypt the model password by default. $model->password = bcrypt($password); return $model; }