PHP Platform

Tenant Scoping Adjustments in Platform Rates

Introduction

The Reimpact platform involves managing various resources, including rate configurations. Recent updates address how these rates are scoped within a multi-tenant environment.

The Issue

Previously, the platform attempted to scope rate resources to a specific tenant (company) using a relationship that no longer existed. This caused errors and prevented proper rate management.

The Solution

The RateResource class was modified to disable tenant scoping. This ensures that rates are treated as global resources, accessible across all tenants.

class RateResource extends Resource
{
    public static $isScopedToTenant = false; 

    // ... other methods ...
}

By setting $isScopedToTenant = false, Filament's default behavior of automatically scoping queries to the current tenant is overridden.

Implications

This change has several important implications:

  1. Global Rates: Rates are now treated as global configurations applicable to all tenants.
  2. Simplified Management: Tenant-specific rate filtering is no longer enforced at the database level.
  3. Potential for Future Customization: While currently global, the system can be extended in the future to support tenant-specific rate overrides through alternative mechanisms if needed.

Considerations

It's crucial to ensure that the application logic correctly handles rate applicability based on the business requirements. Future enhancements might involve introducing a dedicated mechanism for managing tenant-specific rate exceptions or overrides.

Tenant Scoping Adjustments in Platform Rates
GERARDO RUIZ

GERARDO RUIZ

Author

Share: