1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Multi-db fixes

This commit is contained in:
Hillel Coren 2017-05-11 10:52:13 +03:00
parent 6a02c6e80e
commit 2e76d9772a
2 changed files with 12 additions and 1 deletions

View File

@ -30,7 +30,7 @@ class LookupAccount extends LookupModel
$current = config('database.default'); $current = config('database.default');
config(['database.default' => DB_NINJA_LOOKUP]); config(['database.default' => DB_NINJA_LOOKUP]);
$server = DbServer::whereName($current)->firstOrFail(); $server = DbServer::whereName($current)->firstOrFail();
$lookupCompany = LookupCompany::whereDbServerId($server->id) $lookupCompany = LookupCompany::whereDbServerId($server->id)
->whereCompanyId($companyId)->first(); ->whereCompanyId($companyId)->first();
@ -49,4 +49,10 @@ class LookupAccount extends LookupModel
static::setDbServer($current); static::setDbServer($current);
} }
public function getDbServer()
{
return $this->lookupCompany->dbServer->name;
}
} }

View File

@ -22,4 +22,9 @@ class LookupCompany extends LookupModel
return $this->belongsTo('App\Models\DbServer'); return $this->belongsTo('App\Models\DbServer');
} }
public function getDbServer()
{
return $this->dbServer->name;
}
} }