ServerConfigurationRepository.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace ModulesGarden\ProxmoxAddon\App\Repositories;
  3. /**
  4. * Class ServerConfigurationRepository
  5. * @package ModulesGarden\ProxmoxAddon\App\Repositories
  6. * @property $sshHost
  7. * @property $sshPort
  8. * @property $sshUser
  9. * @property $snippetStorage
  10. * @property $snippetDirectory
  11. */
  12. class ServerConfigurationRepository extends AbstractServerConfigurationRepository
  13. {
  14. public function __get($name)
  15. {
  16. return $this->get($name);
  17. }
  18. /**
  19. * @return mixed
  20. */
  21. public function getSshPassword()
  22. {
  23. return html_entity_decode(decrypt($this->sshPassword), ENT_QUOTES);
  24. }
  25. public function getSshKey()
  26. {
  27. return decrypt($this->sshKey);
  28. }
  29. public function hasSshKey()
  30. {
  31. return decrypt($this->sshKey) !="";
  32. }
  33. /**
  34. * @param mixed $sshPassword
  35. * @return ServerConfigurationRepository
  36. */
  37. public function setSshPassword($sshPassword)
  38. {
  39. $this->set('sshPassword',encrypt($sshPassword));
  40. return $this;
  41. }
  42. }