stripe_keys) ->where('is_deleted', false) ->get(); foreach($cgs as $cg) { if($cg->getConfigField('appleDomainVerification')){ return response($cg->getConfigField('appleDomainVerification'),200); } } return response('', 400); } /* Hosted */ $domain_name = $request->getHost(); if (strpos($domain_name, 'invoicing.co') !== false) { $subdomain = explode('.', $domain_name)[0]; $query = [ 'subdomain' => $subdomain, 'portal_mode' => 'subdomain', ]; if($company = MultiDB::findAndSetDbByDomain($query)){ return $this->resolveAppleMerchantId($company); } } $query = [ 'portal_domain' => $request->getSchemeAndHttpHost(), 'portal_mode' => 'domain', ]; if($company = MultiDB::findAndSetDbByDomain($query)){ return $this->resolveAppleMerchantId($company); } return response('', 400); } private function resolveAppleMerchantId($company) { $cgs = $company->company_gateways() ->whereIn('gateway_key', $this->stripe_keys) ->where('is_deleted', false) ->get(); foreach($cgs as $cg) { if($cg->getConfigField('appleDomainVerification')){ return response($cg->getConfigField('appleDomainVerification'),200); } } return response('', 400); } }