PHP code example of gpopoteur / flat

1. Go to this page and download the library: Download gpopoteur/flat library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gpopoteur / flat example snippets


    'GPopoteur\Flat\FlatServiceProvider',

    public function __contruct(Flat $flat){
        // business logic
    }

    $flat = App::make('GPopoteur\Flat\Flat');

    $flat->build('new-tenant');

    $flat->migrate('new-tenant');

    $flat->migrate(['new-tenant', 'other-tenant', 'and-another']);

    $flat->moveIn('new-tenant');

    'flatCheckIn' => 'GPopoteur\Flat\Middleware\FlatCheckInMiddleware'

    Route::group(['domain' => '{flatName}.domain.com', 'middleware' => 'flatCheckIn'], function(){

        // everything inside this closure will be done in the `flatName` schema.

    });

    Route::group(['prefix' => 'account/{flatName}', 'middleware' => 'flatCheckIn'], function(){

        // everything inside this closure will be done in the `flatName` schema.

    });