2017 © Pedro Peláez
 

library multitenancy

A single DB multitenancy package for Laravel based on subdomain routing.

image

lukapeharda/multitenancy

A single DB multitenancy package for Laravel based on subdomain routing.

  • Thursday, January 26, 2017
  • by lpeharda
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

MultiTenancy

Introduction

MultiTenancy is a Laravel single DB multitenancy package based on subdomain routing., (*1)

Installation

Require this package, with Composer, in the root directory of your project., (*2)

composer require lukapeharda/multitenancy

Add the service provider to config/app.php in the providers array., (*3)

LukaPeharda\MultiTenancy\Providers\ContextServiceProvider::class,

Publish the config file and modify its params to fit your needs and installation., (*4)

php artisan vendor:publish --provider="LukaPeharda\MultiTenancy\Providers\ContextServiceProvider"

Usage

Add the LukaPeharda\MultiTenancy\Scopes\Contextable trait to your models that are "tenant" dependable. This trait will automatically load global scope which will filter all your queries by defined tenant key., (*5)

Beside adding trait to your models, your model DB schema needs to have the tenant key as its attribute (and most likely as its foreign key)., (*6)

To disable tenant global scope use withoutGlobalScope builder method:, (*7)

$model->withoutGlobalScope(\LukaPeharda\MultiTenancy\Scopes\TenantScope::class);

Fetching the current tenant (and all of its attributes) is available through helper function context., (*8)

// To fetch entire tenant object
$tenant = context();

// To fetch one of its attribute
$tenantId = context('id');

License

MultiTenancy is open-sourced software licensed under the MIT license, (*9)

The Versions

26/01 2017

dev-master

9999999-dev

A single DB multitenancy package for Laravel based on subdomain routing.

  Sources   Download

MIT

The Requires

 

by Luka Peharda

laravel saas tenant multitenant tenancy multitenancy

26/01 2017

v1.0.2

1.0.2.0

A single DB multitenancy package for Laravel based on subdomain routing.

  Sources   Download

MIT

The Requires

 

by Luka Peharda

laravel saas tenant multitenant tenancy multitenancy

22/01 2017

v1.0.1

1.0.1.0

A single DB multitenancy package for Laravel based on subdomain routing.

  Sources   Download

MIT

The Requires

 

by Luka Peharda

laravel saas tenant multitenant tenancy multitenancy

21/01 2017

v1.0.0

1.0.0.0

A single DB multitenancy package for Laravel based on subdomain routing.

  Sources   Download

MIT

The Requires

 

by Luka Peharda

laravel saas tenant multitenant tenancy multitenancy