Download the PHP package globecode/laravel-multitenant without Composer

On this page you can find all versions of the php package globecode/laravel-multitenant. 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-multitenant

Laravel Multi-Tenant

Sep 29, 2014: WIP for release as an L4 package.

Installation

  1. Require this package in your composer.json file in the "require" block:

  2. Add the service provider to the providers array in app/config/app.php. This is only used for the "Publish config" command two steps down:

  3. cd into your project directory and update via Composer:

  4. Publish the config to your application. This allows you to change the name of the Tenant column name in your schema. A config file will be installed to app/config/packages/globecode/laravel-multitenant/ which you can edit:

  5. Create and run new migrations to setup the necessary schema. Example migrations are provided in the Package migrations folder.

  6. Add the getTenantId() method to your User (and any other "scoped" models) or just once in a BaseModel (recommended):

  7. Optional Global Override. If you want to globally override scope, such as for an Admin, then add the isAdmin() method to your User model. The ScopedByTenant trait will look for this method and automatically override the scope on all queries if this method returns true:

Usage

  1. Scope a model using the ScopedByTenant trait to make all queries on that model globally scoped to a Tenant. Never worry about accidentally querying outside a Tenant's data!

  2. Globally removing scope:

    A: Globally remove scope from a Controller, such as in an Admin situation:

    Or

    B: Globally remove scope by using the Auth check in the ScopedByTenant trait's bootTenantId() method. See the instructions in the Setup -> Optional Global Override section above.

Note: You can use any of the public methods on the ScopedByTenant trait in your models and controllers.

Repositories

If you use repositories, you will need to build queries off of the TenantScope class instead of the ScopedByTenant trait. If you look at the TenantScope class you will see there are extensions to \Illuminate\Database\Query\Builder, these are methods available to your repositories; the trait won't work in repos.

Here is an example Eloquent repository with all the necessary methods for scoping. These methods should go in an EloquentBaseRepository class, to keep things DRY.

Seeding

You can manually override the scoping in your seed files to avoid difficult lookups for relations, by setting the override manually:

Note: set the tenant_id field (or whatever name you chose for the scoping column) on your User model to null for any in-house staff/admins.

About

Conception: Hard fork off AuraEQ Laravel Multi Tenant. Many thanks to him for the initial work.

Packagist: globecode/laravel-multitenant

Hashtag: #laravel-multitenant

Twitter: @jhaurawachsman

Copyright (c) 2014 Jhaura Wachsman

Licensed under MIT.


All versions of laravel-multitenant with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version 4.2.*
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 globecode/laravel-multitenant contains the following files

Loading the files please wait ....