Download the PHP package aura-is-here/laravel-multi-tenant without Composer

On this page you can find all versions of the php package aura-is-here/laravel-multi-tenant. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-multi-tenant

Laravel Multi Tenant




NOTE: THIS PACKAGE HAS MOVED

This package is now Laravel 5.2+ only, and has moved to https://github.com/HipsterJazzbo/Landlord.

This version will no longer be maintained, but will stay here for legacy compatibility.




A general purpose multi-tenancy package for Laravel 5.2+. Accidentally derived from the work of @tonydew, and with help from @rizqidjamaluddin

Installation

To get started, require this package in your composer.json and run composer update:

After updating composer, add the ServiceProvider to the providers array in app/config/app.php:

You'll probably want to set up the alias:

You could also publish the config file:

and set up your tenant_column setting, if you have an app-wide default.

Usage

First off, this package assumes that you have a column on all of your tenant-scoped tables that references which tenant each row belongs to.

For example, you might have a companies table, and all your other tables might have a company_id column (with a foreign key, right?).

Next, you'll have to call TenantScope::addTenant($tenantColumn, $tenantId). It doesn't matter where, as long as it happens on every request. This is important; if you only set the tenant in your login method for example, that won't run for subsequent requests and queries will no longer be scoped.

Some examples of good places to call TenantScope::addTenant($tenantColumn, $tenantId) might be:

Once you've got that all worked out, simply use the trait in all your models that you'd like to scope by tenant:

Henceforth, all operations against that model will be scoped automatically.

You can also set a $tenantColumns property on the model to override the tenants applicable to that model.

If you need to run queries across all tenants, you can do it easily:

When you are developing a multi tenanted application, it can be confusing sometimes why you keep getting ModelNotFound exceptions.

Laravel Multi Tenant will catch those exceptions, and re-throw them as ModelNotFoundForTenant, to help you out :)

Contributing

Please! This is not yet a complete solution, but there's no point in all of us re-inventing this wheel over and over. If you find an issue, or have a better way to do something, open an issue or a pull request.


All versions of laravel-multi-tenant with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version 4.2.*|5.0.*|5.1.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package aura-is-here/laravel-multi-tenant contains the following files

Loading the files please wait ....