canAccessTenant($tenant); } public function view(User $user, Finding $finding): bool { $tenant = Tenant::current(); if (! $tenant) { return false; } if (! $user->canAccessTenant($tenant)) { return false; } return (int) $finding->tenant_id === (int) $tenant->getKey(); } public function update(User $user, Finding $finding): bool { $tenant = Tenant::current(); if (! $tenant instanceof Tenant) { return false; } if (! $user->canAccessTenant($tenant)) { return false; } if ((int) $finding->tenant_id !== (int) $tenant->getKey()) { return false; } return Gate::forUser($user)->allows(Capabilities::TENANT_SYNC, $tenant); } }