1. Go to this page and download the library: Download cidekar/laravel-tenantmagic 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 Cidekar\Tenantmagic\Models\Concerns\UsesPassportModelMagic;
class User extends Authenticatable
{
use UsesPassportModelMagic;
...
return [
/*
* This class is responsible for determining which tenant should be current
* for the given request.
*
* This class should extend `Spatie\Multitenancy\TenantFinder\TenantFinder`
*
*/
'tenant_finder' => TenantmagicDomainTenantFinder::class,
...
return [
/*
* These tasks will be performed when switching tenants.
*
* A valid task is any class that implements Spatie\Multitenancy\Tasks\SwitchTenantTask
*/
'switch_tenant_tasks' => [
SwitchTenantDatabaseTask::class,
TenantmagicPassportTask::class
],
...
return [
/*
* The connection name to reach the tenant database.
*
* Set to `null` to use the default connection.
*/
'tenant_database_connection_name' => 'tenant',
/*
* The connection name to reach the landlord database
*/
'landlord_database_connection_name' => 'landlord',
...