1. Go to this page and download the library: Download solutosoft/yii-multitenant 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/ */
use solutosoft\multitenant\MultiTenantRecord;
class User extends MultiTenantRecord implements IdentityInterface, TenantInterface
{
/**
* {@inheritdoc}
*/
public function getTenantId()
{
return // logic to determine tenant from current user
}
/**
* Finds user by username attribute
* This is an example where tenant filter is disabled
*/
public static function findByUsername($username)
{
return static::find()->withoutTenant()->where(['username' => $username]);
}
...
}
use solutosoft\multitenant\MultiTenantRecord;
class Post extends MultiTenantRecord
{
...
}
class Category extends MultiTenantRecord
{
...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.