Start work on updating services
This commit is contained in:
70
app/Models/Service/Phone.php
Normal file
70
app/Models/Service/Phone.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Service;
|
||||
|
||||
use App\Models\Base\ServiceType;
|
||||
|
||||
/**
|
||||
* Class Phone (Service)
|
||||
* Services that are Voice Telephony
|
||||
*/
|
||||
class Phone extends ServiceType
|
||||
{
|
||||
protected $dates = [
|
||||
'connect_at',
|
||||
'expire_at',
|
||||
];
|
||||
protected $table = 'service_phone';
|
||||
|
||||
/* ABSTRACT */
|
||||
|
||||
/**
|
||||
* Search for a record
|
||||
*
|
||||
* @param $query
|
||||
* @param string $term
|
||||
* @return mixed
|
||||
*/
|
||||
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.'%');
|
||||
}
|
||||
|
||||
/* INTERFACES */
|
||||
|
||||
/**
|
||||
* Return the service address
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getServiceDescriptionAttribute(): string
|
||||
{
|
||||
return strtoupper($this->service_address) ?: '-';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the service number
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getServiceNameAttribute(): string
|
||||
{
|
||||
return $this->service_number ?: ($this->service_address ?: '-');
|
||||
}
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
||||
/**
|
||||
* The type of technology used to provide this Internet Service
|
||||
*
|
||||
* @param $value
|
||||
* @return null|string
|
||||
*/
|
||||
public function getTechnologyAttribute($value): ?string
|
||||
{
|
||||
return $value ?: $this->supplied()->technology;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user