IpAddress.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /* * ********************************************************************
  3. * ProxmoxAddon product developed. (Aug 22, 2018)
  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 Illuminate\Database\Eloquent\model as EloquentModel;
  21. use ModulesGarden\ProxmoxAddon as main;
  22. /**
  23. * Description of RangeVm
  24. *
  25. * @author Pawel Kopec <pawelk@modulesgardne.com>
  26. * @property int $id
  27. * @property string $ip
  28. * @property string $type
  29. * @property string $mac_address
  30. * @property string $subnet_mask
  31. * @property string $gateway
  32. * @property int $cidr
  33. * @property int $sid
  34. * @property string $visualization
  35. * @property string $last_check
  36. * @property int $private
  37. * @property int $hosting_id
  38. * @property string $trunks
  39. * @property string $tag
  40. * @property string $node
  41. * @property string $bridge
  42. * @property main\Core\Models\Whmcs\Hosting $hosting related client hosting
  43. * @method static $this ofHostingId($hostingId)
  44. * @method $this ofTags($tags)
  45. * @method $this ofIp($ip)
  46. */
  47. class IpAddress extends EloquentModel
  48. {
  49. public $timestamps = false;
  50. /** @var string */
  51. protected $table = 'mg_proxmox_addon_ip';
  52. /** @var array */
  53. protected $fillable = ['id', 'ip', 'type', 'mac_address', 'subnet_mask', 'gateway', 'cidr', 'sid', 'visualization', 'last_check', 'private', 'hosting_id', 'trunks', 'tag', 'node', 'bridge'];
  54. /** @var int */
  55. protected $guarded = ['id'];
  56. protected $softDelete = true;
  57. public function hosting()
  58. {
  59. return $this->belongsTo(main\Core\Models\Whmcs\Hosting::class, 'hosting_id');
  60. }
  61. public function scopeOfHostingId($query, $hostingId)
  62. {
  63. return $query->where("hosting_id", $hostingId);
  64. }
  65. public function scopeOfTags($query, $tags)
  66. {
  67. return $query->whereIn("tag", $tags);
  68. }
  69. public function scopeOfIp($query, $ip)
  70. {
  71. return $query->where("ip", $ip);
  72. }
  73. public function scopePrivate($query)
  74. {
  75. return $query->where("private", 1);
  76. }
  77. }