2017 © Pedro Peláez
 

library multi-tenant-laravel

Laravel Multi Tenant Package

image

mymediamagnet/multi-tenant-laravel

Laravel Multi Tenant Package

  • Monday, July 23, 2018
  • by DeveloperPlus
  • Repository
  • 2 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Very short description of the package

Latest Version on Packagist Build Status Quality Score Coverage Status Total Downloads, (*1)

This package is intended to be a flexible starting point for new multi-tenant projects in Laravel. Still a WIP, (*2)

Installation

You can install the package via composer:, (*3)

composer require mymediamagnet/multi-tenant-laravel

Setup

  • Make sure all Auth routes are removed from your routes to start off
  • Run php artisan vendor:publish and selecting multi-tenant-laravel as the package
  • Run php artisan migrate. This will create all the tables required in this package
  • In the file app\Http\Middleware\RedirectIfAuthenticated you might see return redirect('/home');. Change this to return redirect('/');.

Setting Up Your Models

Create the following models for the primary tables in the packages migrations. Make sure to extend the base classes from the package, (*4)

  • Role
  • Permission
  • Tenant
  • Feature
  • User (likely already created)

``` php use MultiTenantLaravel\App\Models\BaseUser;, (*5)

class User extends BaseUser { ... }, (*6)


``` php use MultiTenantLaravel\App\Models\BaseTenant; class Tenant extends BaseTenant { ... }

Follow the same pattern in making your Role, Permission & Feature models, (*7)

Usage

By default your project should now be setup to automatically redirect you to the login page on visit. To create a new user, you can use the helper command., (*8)

php artisan tenant:create-user - you will be asked a series of questions to setup your new user, or you can quickly create a fake user using php artisan tenant:create-user --fake, (*9)

To create a new tenant:, (*10)

php artisan tenant:create-tenant - you will be asked a series of questions to setup your new tenant, or you can quickly create a fake tenant using php artisan tenant:create-tenant --fake, (*11)

When creating a new tenant, you will be provided the option to add an existing user to the tenant, or create a new user., (*12)

Once you login, if your user is only a member of 1 tenant you will be immediatly redirected to that tenants dashboard. Otherwise, you'll land on a dashboard that allows you to select which dashboard you would like to manage, (*13)

Testing

bash composer test, (*14)

Changelog

Please see CHANGELOG for more information on what has changed recently., (*15)

Contributing

Please see CONTRIBUTING for details., (*16)

Security

If you discover any security related issues, please email troy@mymediamagnet.com instead of using the issue tracker., (*17)

Credits

License

The MIT License (MIT). Please see License File for more information., (*18)

The Versions

23/07 2018

dev-master

9999999-dev https://github.com/mymediamagnet/multi-tenant-laravel

Laravel Multi Tenant Package

  Sources   Download

MIT

The Requires

  • php ^7.1

 

The Development Requires

by Troy Jaggard

laravel multi tenant

23/07 2018

dev-new_tenant_with_new_user

dev-new_tenant_with_new_user https://github.com/mymediamagnet/multi-tenant-laravel

Laravel Multi Tenant Package

  Sources   Download

MIT

The Requires

  • php ^7.1

 

The Development Requires

by Troy Jaggard

laravel multi tenant

23/07 2018

dev-create_new_tenant

dev-create_new_tenant https://github.com/mymediamagnet/multi-tenant-laravel

Laravel Multi Tenant Package

  Sources   Download

MIT

The Requires

  • php ^7.1

 

The Development Requires

by Troy Jaggard

laravel multi tenant

20/07 2018

dev-create_new_user_command

dev-create_new_user_command https://github.com/mymediamagnet/multi-tenant-laravel

Laravel Multi Tenant Package

  Sources   Download

MIT

The Requires

  • php ^7.1

 

The Development Requires

by Troy Jaggard

laravel multi tenant

08/07 2018

dev-browserkit-testing

dev-browserkit-testing https://github.com/mymediamagnet/multi-tenant-laravel

Laravel Multi Tenant Package

  Sources   Download

MIT

The Requires

  • php ^7.1

 

The Development Requires

by Troy Jaggard

laravel multi tenant