PHP code example of bakeoff / multitenancy

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

    

bakeoff / multitenancy example snippets


    $this->addBehavior('Bakeoff/Multitenancy.TenantScope');
    

    $this->addBehavior('Bakeoff/Multitenancy.TenantScope', [
        'accountField' => 'another_column_with_account_id'
    ]);
    

    // in ArticlesTable.php
    $this->addBehavior('Bakeoff/Multitenancy.TenantScope', [
        'accountField' => 'Categories.Users.linked_account'
    ]);
    

$this->addPlugin(\Bakeoff\Multitenancy\Plugin::class);

$this->Articles->removeBehavior('TenantScope');