Add VOIP to search
This commit is contained in:
@@ -74,7 +74,7 @@ class Adsl extends ServiceType implements ServiceItem,ServiceUsage
|
||||
/** ATTRIBUTES **/
|
||||
|
||||
/**
|
||||
* @deprecated use $o->type()->service_name;
|
||||
* @deprecated use $o->service_name;
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function getNameAttribute()
|
||||
@@ -104,7 +104,7 @@ class Adsl extends ServiceType implements ServiceItem,ServiceUsage
|
||||
*/
|
||||
public function getServiceNameAttribute(): string
|
||||
{
|
||||
return $this->service_number ?: 'NO Service Number';
|
||||
return $this->service_number ?: $this->service_address;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -18,6 +18,25 @@ class Voip extends ServiceType implements ServiceItem
|
||||
];
|
||||
protected $table = 'ab_service__voip';
|
||||
|
||||
/* SCOPES */
|
||||
|
||||
/**
|
||||
* Search for a record
|
||||
*
|
||||
* @param $query
|
||||
* @param string $term
|
||||
* @return
|
||||
*/
|
||||
public function scopeSearch($query,string $term)
|
||||
{
|
||||
// Build our where clause
|
||||
return parent::scopeSearch($query,$term)
|
||||
->orwhere('service_number','like','%'.$term.'%')
|
||||
->orWhere('service_address','like','%'.$term.'%');
|
||||
}
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
||||
/**
|
||||
* Return the service address
|
||||
*
|
||||
@@ -40,9 +59,11 @@ class Voip extends ServiceType implements ServiceItem
|
||||
*/
|
||||
public function getServiceNameAttribute(): string
|
||||
{
|
||||
return $this->service_number;
|
||||
return $this->service_number ?: $this->service_address;
|
||||
}
|
||||
|
||||
/* METHODS */
|
||||
|
||||
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