Fixes for subdomain resolution for MultiDB

This commit is contained in:
David Bomba 2021-05-15 14:00:29 +10:00
parent b89b6ef38d
commit 364f7addb6
2 changed files with 4 additions and 2 deletions

View File

@ -41,7 +41,7 @@ class SetDomainNameDb
if (strpos($request->getHost(), 'invoicing.co') !== false)
{
$subdomain = array_first(explode('.', $request->getHost()));
$subdomain = explode('.', $request->getHost())[0];
$query = [
'subdomain' => $subdomain,

View File

@ -33,6 +33,7 @@ class SubscriptionTransformer extends EntityTransformer
public function transform(Subscription $subscription): array
{
$company = $subscription->company;
return [
'id' => $this->encodePrimaryKey($subscription->id),
@ -59,7 +60,8 @@ class SubscriptionTransformer extends EntityTransformer
'allow_plan_changes' => (bool)$subscription->allow_plan_changes,
'refund_period' => (int)$subscription->refund_period,
'webhook_configuration' => $subscription->webhook_configuration ?: [],
'purchase_page' => (string)route('client.subscription.purchase', $subscription->hashed_id),
'purchase_page' => (string)$company->domain() . "/client/subscription/{$subscription->hashed_id}/purchase",
//'purchase_page' => (string)route('client.subscription.purchase', $subscription->hashed_id),
'currency_id' => (string) $subscription->currency_id,
'is_deleted' => (bool)$subscription->is_deleted,
'created_at' => (int)$subscription->created_at,