1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 23:34:03 +00:00

Configurable table names

This commit is contained in:
Samuel Štancl 2019-09-20 16:37:40 +02:00
parent d1be6c8e66
commit 2cf2ef0995
3 changed files with 15 additions and 3 deletions

View file

@ -10,7 +10,11 @@ return [
'custom_columns' => [
// 'plan',
],
'connection' => 'central',
'connection' => null, // todo verify this works
'table_names' => [
'TenantModel' => 'tenants',
'DomainModel' => 'domains',
],
],
'redis' => [ // Stancl\Tenancy\StorageDrivers\RedisStorageDriver
'connection' => 'tenancy',

View file

@ -15,7 +15,11 @@ class DomainModel extends Model
protected $primaryKey = 'id';
public $incrementing = false;
public $timestamps = false;
public $table = 'domains';
public function getTable()
{
return config('tenancy.storage.db.table_names.DomainModel', 'domains');
}
public function getConnectionName()
{

View file

@ -15,7 +15,11 @@ class TenantModel extends Model
protected $primaryKey = 'id';
public $incrementing = false;
public $timestamps = false;
public $table = 'tenants';
public function getTable()
{
return config('tenancy.storage.db.table_names.TenantModel', 'tenants');
}
public static function dataColumn()
{