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'); } }