User optimisation and code cleanup
This commit is contained in:
@@ -20,13 +20,7 @@ class ServicePolicy
|
||||
public function view(User $uo, Service $so): bool
|
||||
{
|
||||
// If this is a service for an account managed by a user.
|
||||
return ($uo->services->pluck('id')->search($so->id) !== FALSE)
|
||||
|
||||
// The user is the wholesaler
|
||||
OR $uo->isWholesaler()
|
||||
|
||||
// The user has this as one of their accounts
|
||||
OR $uo->accounts->pluck('id')->contains($so->account_id);
|
||||
return $uo->accounts_all->pluck('id')->contains($so->account_id) || $uo->isWholesaler();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user