- Implemented DomainCollection, DomainDetailResource, DomainNSCollection, DomainNSResource, and DomainResource for handling DNS domain and record data. - Created VpsServiceCollection and VpsServiceResource for VPS service management. - Added DnsManagerNS and DnsManagerUser models to represent DNS records and user associations. - Developed AdminZoneDnsSqlImporter for importing DNS data from SQL dumps, including customer and DNS domain records. - Added migration scripts to update the customers table with new fields and sync foreign key references for DNS tables. - Created a migration preview document outlining the mapping and schema changes for the admin zone DNS import.
53 lines
1.1 KiB
PHP
53 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\LogsActivity;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class DnsDomain extends Model
|
|
{
|
|
use HasFactory, LogsActivity;
|
|
|
|
protected $table = 'dns_manager_domain';
|
|
|
|
protected $fillable = [
|
|
'domain_name',
|
|
'user_id',
|
|
'dns_manager_server_id',
|
|
'is_created',
|
|
'plesk_id',
|
|
];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function customer()
|
|
{
|
|
return $this->belongsToMany(Customer::class, 'dns_domain_user', 'domain_id', 'user_id')->withTimestamps();
|
|
}
|
|
|
|
public function users()
|
|
{
|
|
return $this->customer();
|
|
}
|
|
|
|
public function server()
|
|
{
|
|
return $this->belongsTo(DnsServer::class, 'dns_manager_server_id', 'id');
|
|
}
|
|
|
|
public function ns()
|
|
{
|
|
return $this->hasMany(DnsManagerNS::class, 'dns_manager_domain_id', 'id');
|
|
}
|
|
|
|
public function record()
|
|
{
|
|
return $this->hasMany(DnsRecord::class, 'dns_manager_domain_id', 'id');
|
|
}
|
|
}
|