User optimisation and code cleanup
This commit is contained in:
@@ -19,14 +19,7 @@ class InvoicePolicy
|
||||
*/
|
||||
public function view(User $uo,Invoice $io): bool
|
||||
{
|
||||
// If this is a service for an account managed by a user.
|
||||
return ($uo->invoices->pluck('id')->search($io->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($io->account_id);
|
||||
return $uo->accounts_all->pluck('id')->contains($io->account_id) || $uo->isWholesaler();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user