mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 07:14:36 -04:00
Fix DB search
This commit is contained in:
parent
3ad0a3ff9a
commit
bbabe4836b
@ -33,6 +33,7 @@ class InvitationController extends Controller
|
|||||||
{
|
{
|
||||||
|
|
||||||
$invitation = InvoiceInvitation::whereInvitationKey($invitation_key)->first();
|
$invitation = InvoiceInvitation::whereInvitationKey($invitation_key)->first();
|
||||||
|
// $invitation = InvoiceInvitation::whereRaw("BINARY `invitation_key`= ?", [$invitation_key])->first();
|
||||||
|
|
||||||
if($invitation){
|
if($invitation){
|
||||||
$invitation->markViewed();
|
$invitation->markViewed();
|
||||||
|
@ -26,13 +26,12 @@ class SetDomainNameDb
|
|||||||
|
|
||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
|
|
||||||
$error['error'] = ['message' => 'Database could not be set'];
|
$error['error'] = ['message' => 'Database could not be set'];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use the host name to set the active DB
|
* Use the host name to set the active DB
|
||||||
**/
|
**/
|
||||||
if( $request->getHttpHost() && config('ninja.db.multi_db_enabled') && ! MultiDB::findAndSetDbByDomain($request->getHttpHost()))
|
if( $request->getSchemeAndHttpHost() && config('ninja.db.multi_db_enabled') && ! MultiDB::findAndSetDbByDomain($request->getSchemeAndHttpHost()))
|
||||||
{
|
{
|
||||||
if(request()->json)
|
if(request()->json)
|
||||||
return response()->json(json_encode($error, JSON_PRETTY_PRINT) ,403);
|
return response()->json(json_encode($error, JSON_PRETTY_PRINT) ,403);
|
||||||
|
@ -143,13 +143,15 @@ class MultiDB
|
|||||||
|
|
||||||
public static function findAndSetDbByDomain($domain) :bool
|
public static function findAndSetDbByDomain($domain) :bool
|
||||||
{
|
{
|
||||||
|
\Log::error("searching for {$domain}");
|
||||||
|
|
||||||
foreach (self::$dbs as $db)
|
foreach (self::$dbs as $db)
|
||||||
{
|
{
|
||||||
|
$company = Company::on($db)->whereDomain($domain)->first();
|
||||||
|
\Log::error($company);
|
||||||
if($company = Company::on($db)->whereDomain($domain)->first())
|
if($company = Company::on($db)->whereDomain($domain)->first())
|
||||||
{
|
{
|
||||||
|
\Log::error("setting db");
|
||||||
self::setDb($company->db);
|
self::setDb($company->db);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user