Skip to content

Refactor service override functionality to allow for tenancy-specific services #110

@ollieread

Description

@ollieread

Introduce the optional tenancy option to service overrides. If this option is provided, the tenancy of the same registered name will be used to create the service. If the option is null, empty or missing, the current tenancy will be used.

I.e, if you have two tenancies, companies and teams, and you want the filesystem disk company-data to only be created for the current company, you'd specify the tenancy in its config.

'company-data' => [
    'driver'  => 'sprout',
    'disk'    => 'local',
    'tenancy' => 'companies',
],

As service overrides being enabled on a per-tenancy basis is already handled, this functionality will need to be implemented directly by the override itself.

Failure

If the corresponding tenancy is not in the current tenancy stack, an exception must be thrown.

Access

By default, the disk should be accessible to any tenancy, but only created for the specified tenancy. This is okay to do, as if one tenancy isn't related to the other, they shouldn't both be active for the same request.

Note

This should be mentioned in the documentation specifically.

Additional

The current tenancy functionality provided by Sprout\Sprout will need to be refactored to allow for looking at more than all current tenancies, or just the last one.

Metadata

Metadata

Assignees

Labels

status: acceptedThe issue has been accepted/acknowledged and is being actioned or will betype: refactorRefactoring of code

Type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions