Work on VOIP and Domain products
This commit is contained in:
@@ -15,22 +15,11 @@ class Adsl extends ServiceType implements ServiceItem
|
||||
use NextKey;
|
||||
const RECORD_ID = 'service__adsl';
|
||||
|
||||
// @todo column service_id can be removed.
|
||||
protected $table = 'ab_service__adsl';
|
||||
protected $dates = [
|
||||
'service_connect_date',
|
||||
'service_contract_date'
|
||||
];
|
||||
|
||||
/**
|
||||
* The service this belongs to
|
||||
*
|
||||
* @return BelongsTo|MorphOne
|
||||
*/
|
||||
public function service()
|
||||
{
|
||||
return $this->belongsTo(Service::class);
|
||||
}
|
||||
protected $table = 'ab_service__adsl';
|
||||
|
||||
/** SCOPES */
|
||||
|
||||
|
@@ -2,23 +2,46 @@
|
||||
|
||||
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 \App\Models\Base\ServiceType
|
||||
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 tld()
|
||||
public function registrar()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\DomainTld::class,'domain_tld_id');
|
||||
return $this->belongsTo(DomainRegistrar::class,'domain_registrar_id');
|
||||
}
|
||||
|
||||
public function getNameAttribute()
|
||||
public function tld()
|
||||
{
|
||||
return sprintf('%s.%s',$this->domain_name,$this->tld->name);
|
||||
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();
|
||||
}
|
||||
}
|
@@ -11,6 +11,10 @@ class Voip extends ServiceType implements ServiceItem
|
||||
use NextKey;
|
||||
const RECORD_ID = 'service__adsl';
|
||||
|
||||
protected $dates = [
|
||||
'service_connect_date',
|
||||
'service_contract_date',
|
||||
];
|
||||
protected $table = 'ab_service__voip';
|
||||
|
||||
/**
|
||||
@@ -32,4 +36,9 @@ class Voip extends ServiceType implements ServiceItem
|
||||
{
|
||||
return $this->service_number;
|
||||
}
|
||||
|
||||
public function inContract(): bool
|
||||
{
|
||||
return $this->service_contract_date AND $this->service_contract_date->addMonths($this->contract_term)->isFuture();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user