Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/DomainSetWallet.php
Show All 26 Lines | class DomainSetWallet extends Command | ||||
/** | /** | ||||
* Execute the console command. | * Execute the console command. | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
$domain = Domain::where('namespace', $this->argument('domain'))->first(); | $domain = Domain::withEnvTenant()->where('namespace', $this->argument('domain'))->first(); | ||||
if (!$domain) { | if (!$domain) { | ||||
$this->error("Domain not found."); | $this->error("Domain not found."); | ||||
return 1; | return 1; | ||||
} | } | ||||
$wallet = Wallet::find($this->argument('wallet')); | $wallet = Wallet::find($this->argument('wallet')); | ||||
if (!$wallet) { | if (!$wallet || !$wallet->owner()->withEnvTenant()->withTrashed()->first()) { | ||||
$this->error("Wallet not found."); | $this->error("Wallet not found."); | ||||
return 1; | return 1; | ||||
} | } | ||||
if ($domain->entitlement) { | if ($domain->entitlement) { | ||||
$this->error("Domain already assigned to a wallet: {$domain->entitlement->wallet->id}."); | $this->error("Domain already assigned to a wallet: {$domain->entitlement->wallet->id}."); | ||||
return 1; | return 1; | ||||
} | } | ||||
Show All 17 Lines |