| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?php
- /* * ********************************************************************
- * ProxmoxVPS Product developed. (26.03.19)
- * *
- *
- * CREATED BY MODULESGARDEN -> http://modulesgarden.com
- * CONTACT -> contact@modulesgarden.com
- *
- *
- * This software is furnished under a license and may be used and copied
- * only in accordance with the terms of such license and with the
- * inclusion of the above copyright notice. This software or any other
- * copies thereof may not be provided or otherwise made available to any
- * other person. No title to and ownership of the software is hereby
- * transferred.
- *
- *
- * ******************************************************************** */
- namespace ModulesGarden\ProxmoxAddon\App\Models;
- use ModulesGarden\ProxmoxAddon\App\Models\Whmcs\Hosting;
- use ModulesGarden\ProxmoxAddon\Core\Models\ExtendedEloquentModel;
- /**
- * @property int $id
- * @property int $hosting_id
- * @property int $server_id
- * @property string $ip
- * @property string $mac_address
- * @property string $subnet_mask
- * @property string $gateway
- * @property int $cidr
- * @property int $trunks
- * @property int $tag
- * @property string $net
- * @property int $vm_id
- * @method static $this ofHostingId($hostingId)
- * @method $this ofIp($ip)
- * @method $this ofIp4()
- * @method $this ofIp6()
- * @method $this ofNetNull()
- * @method $this ofNetNotNull()
- * @method $this ofNet($net)
- * @method $this limit($limit)
- * @method $this orderByIdDesc()
- * @method $this orderByIdAsc()
- * @method $this ofVmId($id)
- * @method $this notIdIn($ids)
- * @property Hosting $hosting
- * @property VmModel $vmModel
- */
- class VmIpAddress extends ExtendedEloquentModel
- {
- public $timestamps = false;
- /** @var string */
- protected $table = 'VmIpAddress';
- protected $fillable = [ 'hosting_id', "vm_id", 'server_id', 'ip', 'mac_address', 'subnet_mask', 'gateway', 'cidr', 'trunks', 'tag', 'net'];
- public function hosting()
- {
- return $this->belongsTo(Hosting::class, 'hosting_id');
- }
- public function vmModel()
- {
- return $this->belongsTo(VmModel::class, 'vm_id');
- }
- public function scopeOfHostingId($query, $hostingId)
- {
- return $query->where("hosting_id", $hostingId);
- }
- public function scopeOfIp($query, $ip)
- {
- return $query->where("ip", $ip);
- }
- public function scopeOfIp4($query)
- {
- return $query->where('ip', 'LIKE', '%.%');
- }
- public function scopeOfIp6($query)
- {
- return $query->where('ip', 'LIKE', '%:%');
- }
- public function scopeOfNetNull($query)
- {
- return $query->whereNull('net');
- }
- public function scopeOfNetNotNull($query)
- {
- return $query->whereNotNull('net');
- }
- public function scopeOfNet($query, $net)
- {
- return $query->where('net', $net);
- }
- public function scopeOrderByIdDesc($query)
- {
- return $query->orderBy('id', "DESC");
- }
- public function scopeOrderByIdAsc($query)
- {
- return $query->orderBy('id', "ASC");
- }
- public function scopeOfVmId($query, $id)
- {
- return $query->where('vm_id', $id);
- }
- public function scopeNotIdIn($query, $ids)
- {
- return $query->whereNotIn("vm_id", $ids);
- }
- public function scopeOfVmIdNull($query)
- {
- return $query->whereNull('vm_id');
- }
- }
|