2019-06-07 06:54:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models\Service;
|
|
|
|
|
2020-02-19 12:37:45 +00:00
|
|
|
use App\Models\Base\ServiceType;
|
|
|
|
use App\Models\DomainRegistrar;
|
|
|
|
use App\Models\DomainTld;
|
|
|
|
use App\Interfaces\ServiceItem;
|
2019-06-13 04:32:34 +00:00
|
|
|
use App\Traits\NextKey;
|
|
|
|
|
2020-02-19 12:37:45 +00:00
|
|
|
class Domain extends ServiceType implements ServiceItem
|
2019-06-07 06:54:27 +00:00
|
|
|
{
|
2019-06-13 04:32:34 +00:00
|
|
|
use NextKey;
|
|
|
|
const RECORD_ID = 'service__domain';
|
|
|
|
|
2020-02-19 12:37:45 +00:00
|
|
|
protected $dates = [
|
|
|
|
'domain_expire',
|
|
|
|
];
|
2019-06-07 06:54:27 +00:00
|
|
|
protected $table = 'ab_service__domain';
|
2020-02-10 11:07:46 +00:00
|
|
|
protected $with = ['tld'];
|
2019-06-07 06:54:27 +00:00
|
|
|
|
2020-02-19 12:37:45 +00:00
|
|
|
public function registrar()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(DomainRegistrar::class,'domain_registrar_id');
|
|
|
|
}
|
|
|
|
|
2019-06-07 06:54:27 +00:00
|
|
|
public function tld()
|
|
|
|
{
|
2020-02-19 12:37:45 +00:00
|
|
|
return $this->belongsTo(DomainTld::class,'domain_tld_id');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getServiceDescriptionAttribute(): string
|
|
|
|
{
|
|
|
|
// N/A
|
2020-02-20 11:54:28 +00:00
|
|
|
return 'Domain Name';
|
2020-02-19 12:37:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getServiceNameAttribute(): string
|
|
|
|
{
|
|
|
|
return sprintf('%s.%s',strtoupper($this->domain_name),strtoupper($this->tld->name));
|
2019-06-07 06:54:27 +00:00
|
|
|
}
|
|
|
|
|
2020-02-19 12:37:45 +00:00
|
|
|
public function inContract(): bool
|
2019-06-07 06:54:27 +00:00
|
|
|
{
|
2020-02-19 12:37:45 +00:00
|
|
|
return $this->domain_expire->isFuture();
|
2019-06-07 06:54:27 +00:00
|
|
|
}
|
|
|
|
}
|