39 lines
824 B
PHP
39 lines
824 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\Server\ServerType;
|
|
use App\Traits\LogsActivity;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class DnsServer extends Model
|
|
{
|
|
use HasFactory, LogsActivity;
|
|
|
|
protected $table = 'dns_manager_servers';
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'ip_address',
|
|
'panel_port',
|
|
'password',
|
|
'username',
|
|
'api_key',
|
|
'status',
|
|
'type',
|
|
];
|
|
|
|
public function servesHosting(): bool
|
|
{
|
|
$type = $this->attributes['type'] ?? ServerType::DOMAIN->value;
|
|
|
|
return in_array($type, [ServerType::HOSTING->value, ServerType::BOTH->value], true);
|
|
}
|
|
|
|
protected function scopeIsActive($query)
|
|
{
|
|
return $query->where('status', 'activated');
|
|
}
|
|
}
|