NodeSetting.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /* * ********************************************************************
  3. * ProxmoxAddon product developed. (Jan 15, 2019)
  4. * *
  5. *
  6. * CREATED BY MODULESGARDEN -> http://modulesgarden.com
  7. * CONTACT -> contact@modulesgarden.com
  8. *
  9. *
  10. * This software is furnished under a license and may be used and copied
  11. * only in accordance with the terms of such license and with the
  12. * inclusion of the above copyright notice. This software or any other
  13. * copies thereof may not be provided or otherwise made available to any
  14. * other person. No title to and ownership of the software is hereby
  15. * transferred.
  16. *
  17. *
  18. * ******************************************************************** */
  19. namespace ModulesGarden\ProxmoxAddon\App\Models;
  20. use ModulesGarden\ProxmoxAddon\Core\Models\ExtendedEloquentModel;
  21. /**
  22. * Description of NodeSetting
  23. *
  24. * @author Pawel Kopec <pawelk@modulesgardne.com>
  25. * @property string $server_id
  26. * @property string $node
  27. * @property string $setting
  28. * @property string $value
  29. * @property \ModulesGarden\ProxmoxAddon\Core\Models\Whmcs\Server $server
  30. * @method NodeSetting ofServer(int $serverId)
  31. * @method NodeSetting ofNode(string $node)
  32. * @method NodeSetting ofNodes(array $nodes)
  33. * @method NodeSetting ofSetting(string $setting)
  34. * @method NodeSetting ofValue(string $value)
  35. */
  36. class NodeSetting extends ExtendedEloquentModel
  37. {
  38. public $timestamps = false;
  39. protected $table = 'NodeSetting';
  40. protected $fillable = ['server_id', 'node', 'setting', 'value'];
  41. protected $softDelete = false;
  42. public function server()
  43. {
  44. return $this->belongsTo('ModulesGarden\ProxmoxAddon\Core\Models\Whmcs\Server', 'server_id');
  45. }
  46. public function scopeOfServer($query, $serverId)
  47. {
  48. return $query->where('server_id', $serverId);
  49. }
  50. public function scopeOfNode($query, $node)
  51. {
  52. return $query->where('node', $node);
  53. }
  54. public function scopeOfSetting($query, $setting)
  55. {
  56. return $query->where('setting', $setting);
  57. }
  58. public function scopeOfValue($query, $value)
  59. {
  60. return $query->where('value', $value);
  61. }
  62. public function scopeOfNodes($query, $nodes)
  63. {
  64. return $query->whereIn('node', $nodes);
  65. }
  66. }