1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 21:54: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' => [ 'custom_columns' => [
// 'plan', // 'plan',
], ],
'connection' => 'central', 'connection' => null, // todo verify this works
'table_names' => [
'TenantModel' => 'tenants',
'DomainModel' => 'domains',
],
], ],
'redis' => [ // Stancl\Tenancy\StorageDrivers\RedisStorageDriver 'redis' => [ // Stancl\Tenancy\StorageDrivers\RedisStorageDriver
'connection' => 'tenancy', 'connection' => 'tenancy',

View file

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

View file

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