Consistency and SQL Query optimisations - focused around the UI
This commit is contained in:
@@ -75,19 +75,14 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
|
||||
/* GENERAL METHODS */
|
||||
|
||||
public function addresses(Domain $o=NULL): Collection
|
||||
public function addresses(): Collection
|
||||
{
|
||||
return Address::select('addresses.*')
|
||||
->join('systems',['systems.id'=>'addresses.system_id'])
|
||||
->join('system_user',['system_user.system_id'=>'systems.id'])
|
||||
->when(! is_null($o),function($query) use ($o) {
|
||||
return $query
|
||||
->join('zones',['zones.id'=>'addresses.zone_id'])
|
||||
->where('zones.domain_id',$o->id);
|
||||
})
|
||||
->where('system_user.user_id',$this->id)
|
||||
->activeFTN()
|
||||
->with(['zone.domain'])
|
||||
->ActiveFTN()
|
||||
->FTN()
|
||||
->get();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user