2019-06-07 06:54:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models\Service;
|
|
|
|
|
2022-04-02 09:26:59 +00:00
|
|
|
use Carbon\Carbon;
|
|
|
|
|
2020-02-20 11:54:28 +00:00
|
|
|
use App\Interfaces\ServiceItem;
|
|
|
|
use App\Models\Base\ServiceType;
|
|
|
|
use App\Models\DomainTld;
|
|
|
|
use App\Models\HostServer;
|
2019-06-13 04:32:34 +00:00
|
|
|
use App\Traits\NextKey;
|
2022-04-02 09:26:59 +00:00
|
|
|
use App\Traits\{ScopeServiceActive,ScopeServiceUserAuthorised};
|
2019-06-13 04:32:34 +00:00
|
|
|
|
2020-02-20 11:54:28 +00:00
|
|
|
class Host extends ServiceType implements ServiceItem
|
2019-06-07 06:54:27 +00:00
|
|
|
{
|
2022-04-02 09:26:59 +00:00
|
|
|
use ScopeServiceActive,ScopeServiceUserAuthorised;
|
2019-06-13 04:32:34 +00:00
|
|
|
use NextKey;
|
|
|
|
const RECORD_ID = 'service__hosting';
|
|
|
|
|
2020-02-20 11:54:28 +00:00
|
|
|
protected $dates = [
|
|
|
|
'host_expire',
|
|
|
|
];
|
2022-04-02 07:06:34 +00:00
|
|
|
public $dateFormat = 'U';
|
2019-06-07 06:54:27 +00:00
|
|
|
protected $table = 'ab_service__hosting';
|
|
|
|
|
2020-02-20 11:54:28 +00:00
|
|
|
public function provider()
|
2019-06-07 06:54:27 +00:00
|
|
|
{
|
2020-02-20 11:54:28 +00:00
|
|
|
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';
|
|
|
|
}
|
|
|
|
|
2021-07-13 02:31:56 +00:00
|
|
|
public function getServiceExpireAttribute(): Carbon
|
|
|
|
{
|
2022-04-02 09:26:59 +00:00
|
|
|
return $this->host_expire;
|
2021-07-13 02:31:56 +00:00
|
|
|
}
|
|
|
|
|
2020-02-20 11:54:28 +00:00
|
|
|
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();
|
2019-06-07 06:54:27 +00:00
|
|
|
}
|
|
|
|
}
|