2017-25 © Pedro Peláez
 

library office-building

office building is a multi tenancy package for laravel

image

yanhaoli/office-building

office building is a multi tenancy package for laravel

  • Friday, July 20, 2018
  • by yanhao-li
  • Repository
  • 2 Watchers
  • 7 Stars
  • 50 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 7 Versions
  • 400 % Grown

The README.md

, (*1)

Office Building

Travis license PRs Welcome, (*2)

Office Building is an easy to use Laravel package to help you build the Multi-tenant SaaS with database-per-tenant. Support Laravel 5.3+, (*3)

Installation

Install Office Building via Composer:, (*4)

composer require yanhaoli/office-building

For laravel >= 5.5 that's all, thanks to Package Discovery., (*5)

For laravel <= 5.5, you have to add Yanhaoli\OfficeBuilding\Providers\OfficeBuildingServiceProvider to your config/app.php providers array:, (*6)

Yanhaoli\OfficeBuilding\Providers\OfficeBuildingServiceProvider::class,

Usage

  1. Config the basis Firstly you have to publish the config file with the following command:, (*7)

    php artisan vendor:publish --provider="Yanhaoli\OfficeBuilding\Providers\OfficeBuildingServiceProvider"
    

    Now checkout config/officebuilding.php and modify it by your needs., (*8)

  2. Open a new Office for your customer, (*9)

    ``` php <?php, (*10)

    namespace App\Http\Controller; use OfficeBuilding; use App\Company;, (*11)

    class CompanyController extends Controller { public function create(Request $request) { $company_name = $request->input('name'); $database_name = OfficeBuilding::addOffice($company_name); $company = new Company; $company->name = $company_name; $company->database_name = $database_name; $company->save(); return response('created', 201); } } ```, (*12)

  3. Handle request for a specific office. Ex, Get all employees of that office, (*13)

    use OfficeBuilding::visit method to switch database connection to a specific office, with a callback method to handle request, the connection will be revert to the previous status after task completed., (*14)

    <?php
    
    namespace App\Http\Controller;
    use OfficeBuilding;
    use App\OfficeBuilding\Employee;
    
    class OfficeEmployeeController extends Controller
    {
      public function browse(Request $request, $office_id)
      {
        $employees = OfficeBuilding::visit($office_id, function(){
          return Employee::all();
        });
    
        return response($employees, 200);
      }
    }
    

Contributing

Welcome any contributions for issue fix or functionality improvement., (*15)

Security Vulnerabilities

If you discover a security vulnerability , please shot me an email at hi@yanhaoli.com., (*16)

License

The MIT License (MIT). Please see MIT license for more information., (*17)

The Versions

20/07 2018

dev-master

9999999-dev

office building is a multi tenancy package for laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Yanhao Li

laravel tenancy multitenancy

20/07 2018

1.0.5

1.0.5.0

office building is a multi tenancy package for laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Yanhao Li

laravel tenancy multitenancy

16/05 2018

1.0.4

1.0.4.0

office building is a multi tenancy package for laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Yanhao Li

laravel tenancy multitenancy

16/05 2018

1.0.3

1.0.3.0

office building is a multi tenancy package for laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Yanhao Li

laravel tenancy multitenancy

14/05 2018

1.0.2

1.0.2.0

office building is a multi tenancy package for laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Yanhao Li

laravel tenancy multitenancy

14/05 2018

1.0.1

1.0.1.0

office building is a multi tenancy package for laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Yanhao Li

laravel tenancy multitenancy

11/05 2018

1.0.0

1.0.0.0

office building is a multi tenancy package for laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Yanhao Li

laravel tenancy multitenancy