Upgrade to Laravel 11, begining of enabling network join functionality, removed QueryCacheable

This commit is contained in:
2024-04-26 16:18:40 +10:00
parent 6e376100a5
commit 79b180f453
16 changed files with 1086 additions and 1018 deletions

View File

@@ -75,27 +75,21 @@ class User extends Authenticatable implements MustVerifyEmail
/* GENERAL METHODS */
public function addresses(): Collection
public function addresses(Domain $o=NULL): 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)
->with(['zone.domain'])
->get();
}
/**
* See if the user is already a member of the chosen network
*
* @param Domain $o
* @return bool
*/
public function isMember(Domain $o): bool
{
return FALSE;
}
/**
* Is this user a ZC of a domain?
*
@@ -128,6 +122,8 @@ class User extends Authenticatable implements MustVerifyEmail
*/
public function zc(): Collection
{
$this->load('systems.addresses');
return $this->systems->pluck('addresses')->flatten()->where('role',Address::NODE_ZC);
}
}