PHP code example of lukapeharda / multitenancy

1. Go to this page and download the library: Download lukapeharda/multitenancy 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/ */

    

lukapeharda / multitenancy example snippets


LukaPeharda\MultiTenancy\Providers\ContextServiceProvider::class,

$model->withoutGlobalScope(\LukaPeharda\MultiTenancy\Scopes\TenantScope::class);

// To fetch entire tenant object
$tenant = context();

// To fetch one of its attribute
$tenantId = context('id');
bash
php artisan vendor:publish --provider="LukaPeharda\MultiTenancy\Providers\ContextServiceProvider"