Start work on updating services

This commit is contained in:
Deon George
2022-04-19 17:07:39 +10:00
parent ebf08ea414
commit 621a132e35
63 changed files with 1038 additions and 612 deletions

View File

@@ -2,55 +2,25 @@
namespace App\Models\Service;
use Carbon\Carbon;
use App\Interfaces\ServiceItem;
use App\Models\Base\ServiceType;
use App\Models\DomainTld;
use App\Traits\ServiceDomains;
use App\Models\HostServer;
use App\Traits\NextKey;
use App\Traits\{ScopeServiceActive,ScopeServiceUserAuthorised};
class Host extends ServiceType implements ServiceItem
/**
* Class Host (Service)
* Services that are Web Hosting
*/
class Host extends ServiceType
{
use ScopeServiceActive,ScopeServiceUserAuthorised;
use NextKey;
const RECORD_ID = 'service__hosting';
use ServiceDomains;
protected $dates = [
'host_expire',
];
public $dateFormat = 'U';
protected $table = 'ab_service__hosting';
protected $table = 'service_host';
protected $with = ['tld'];
/* RELATIONS */
public function provider()
{
return $this->belongsTo(HostServer::class,'host_server_id');
}
public function tld()
{
return $this->belongsTo(DomainTld::class,'domain_tld_id');
}
public function getServiceDescriptionAttribute(): string
{
// N/A
return 'Hosting';
}
public function getServiceExpireAttribute(): Carbon
{
return $this->host_expire;
}
public function getServiceNameAttribute(): string
{
return sprintf('%s.%s',strtoupper($this->domain_name),strtoupper($this->tld->name));
}
public function inContract(): bool
{
return $this->host_expire->isFuture();
}
}