Changeset View
Changeset View
Standalone View
Standalone View
src/app/Domain.php
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | public function assignPackage($package, $user) | ||||
if ($wallet) { | if ($wallet) { | ||||
\Log::error( | \Log::error( | ||||
"Domain {$this->namespace} is already assigned to {$wallet->owner->email}" | "Domain {$this->namespace} is already assigned to {$wallet->owner->email}" | ||||
); | ); | ||||
return $this; | return $this; | ||||
} | } | ||||
$wallet_id = $user->wallets()->first()->id; | return $this->assignPackageAndWallet($package, $user->wallets()->first()); | ||||
foreach ($package->skus as $sku) { | |||||
for ($i = $sku->pivot->qty; $i > 0; $i--) { | |||||
\App\Entitlement::create( | |||||
[ | |||||
'wallet_id' => $wallet_id, | |||||
'sku_id' => $sku->id, | |||||
'cost' => $sku->pivot->cost(), | |||||
'fee' => $sku->pivot->fee(), | |||||
'entitleable_id' => $this->id, | |||||
'entitleable_type' => Domain::class | |||||
] | |||||
); | |||||
} | |||||
} | |||||
return $this; | |||||
} | } | ||||
/** | /** | ||||
* Return list of public+active domain names (for current tenant) | * Return list of public+active domain names (for current tenant) | ||||
*/ | */ | ||||
public static function getPublicDomains(): array | public static function getPublicDomains(): array | ||||
{ | { | ||||
return self::withEnvTenantContext() | return self::withEnvTenantContext() | ||||
▲ Show 20 Lines • Show All 388 Lines • Show Last 20 Lines |