osb/app/Models/Service/Domain.php

47 lines
931 B
PHP
Raw Normal View History

<?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;
use App\Traits\NextKey;
2020-02-19 12:37:45 +00:00
class Domain extends ServiceType implements ServiceItem
{
use NextKey;
const RECORD_ID = 'service__domain';
2020-02-19 12:37:45 +00:00
protected $dates = [
'domain_expire',
];
protected $table = 'ab_service__domain';
2020-02-10 11:07:46 +00:00
protected $with = ['tld'];
2020-02-19 12:37:45 +00:00
public function registrar()
{
return $this->belongsTo(DomainRegistrar::class,'domain_registrar_id');
}
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
return '';
}
public function getServiceNameAttribute(): string
{
return sprintf('%s.%s',strtoupper($this->domain_name),strtoupper($this->tld->name));
}
2020-02-19 12:37:45 +00:00
public function inContract(): bool
{
2020-02-19 12:37:45 +00:00
return $this->domain_expire->isFuture();
}
}