Optimise User all_accounts(),all_clients(), added Invoice/Service to search

This commit is contained in:
Deon George
2020-01-12 23:42:32 +11:00
parent 34c0380c99
commit f13c084a4b
4 changed files with 104 additions and 31 deletions

View File

@@ -219,6 +219,18 @@ class Service extends Model
return $query->setEagerLoads([]);
}
/**
* Search for a record
*
* @param $query
* @param string $term
* @return
*/
public function scopeSearch($query,string $term)
{
return $query->where('id','like','%'.$term.'%');
}
/** ATTRIBUTES **/
/**
@@ -326,7 +338,7 @@ class Service extends Model
* For ADSL, this would be the phone number,
* For Hosting, this would be the domain name, etc
*/
public function getNameShortAttribute(): string
public function getNameShortAttribute()
{
return $this->model ? $this->type->name : 'NAME UNKNOWN';
}