Consistency and SQL Query optimisations - focused around the UI
This commit is contained in:
@@ -395,16 +395,14 @@ class Address extends Model
|
||||
*
|
||||
* @param $query
|
||||
* @return mixed
|
||||
* @note zones and domains needs to be joined in the base call, or use FTN()
|
||||
*/
|
||||
public function scopeActiveFTN($query)
|
||||
{
|
||||
return $query->select($this->getTable().'.*')
|
||||
->join('zones',['zones.id'=>'addresses.zone_id'])
|
||||
->join('domains',['domains.id'=>'zones.domain_id'])
|
||||
return $query
|
||||
->where('zones.active',TRUE)
|
||||
->where('domains.active',TRUE)
|
||||
->active()
|
||||
->FTNorder();
|
||||
->active();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -416,13 +414,21 @@ class Address extends Model
|
||||
public function scopeFTN($query)
|
||||
{
|
||||
return $query
|
||||
->select(['id','addresses.zone_id','host_id','node_id','point_id','system_id'])
|
||||
->select(['addresses.id','region_id','host_id','node_id','point_id','addresses.zone_id','addresses.active','role','security','addresses.system_id','addresses.active','validated'])
|
||||
->join('zones',['zones.id'=>'addresses.zone_id'])
|
||||
->join('domains',['domains.id'=>'zones.domain_id'])
|
||||
->orderBy('domains.name')
|
||||
->orderBy('region_id')
|
||||
->orderBy('host_id')
|
||||
->orderBy('node_id')
|
||||
->orderBy('point_id')
|
||||
->with([
|
||||
'zone:zones.id,domain_id,zone_id',
|
||||
'zone.domain:domains.id,name',
|
||||
'zone:zones.id,domain_id,zone_id,active',
|
||||
'zone.domain:domains.id,name,active,public',
|
||||
]);
|
||||
}
|
||||
|
||||
/** @deprecated use FTN() */
|
||||
public function scopeFTNOrder($query)
|
||||
{
|
||||
return $query
|
||||
|
Reference in New Issue
Block a user