osb/app/Models/Service/Domain.php
2020-02-19 23:37:45 +11:00

47 lines
931 B
PHP

<?php
namespace App\Models\Service;
use App\Models\Base\ServiceType;
use App\Models\DomainRegistrar;
use App\Models\DomainTld;
use App\Interfaces\ServiceItem;
use App\Traits\NextKey;
class Domain extends ServiceType implements ServiceItem
{
use NextKey;
const RECORD_ID = 'service__domain';
protected $dates = [
'domain_expire',
];
protected $table = 'ab_service__domain';
protected $with = ['tld'];
public function registrar()
{
return $this->belongsTo(DomainRegistrar::class,'domain_registrar_id');
}
public function tld()
{
return $this->belongsTo(DomainTld::class,'domain_tld_id');
}
public function getServiceDescriptionAttribute(): string
{
// N/A
return '';
}
public function getServiceNameAttribute(): string
{
return sprintf('%s.%s',strtoupper($this->domain_name),strtoupper($this->tld->name));
}
public function inContract(): bool
{
return $this->domain_expire->isFuture();
}
}