Page MenuHomePhorge

DomainSetWallet.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

DomainSetWallet.php

<?php
namespace App\Console\Commands;
use App\Console\Command;
use App\Entitlement;
use App\Domain;
use App\Sku;
use App\Wallet;
use Illuminate\Support\Facades\Queue;
class DomainSetWallet extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'domain:set-wallet {domain} {wallet}';
/**
* The console command description.
*
* @var string
*/
protected $description = "Assign a domain to a wallet.";
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$domain = $this->getDomain($this->argument('domain'));
if (!$domain) {
$this->error("Domain not found.");
return 1;
}
$wallet = $this->getWallet($this->argument('wallet'));
if (!$wallet) {
$this->error("Wallet not found.");
return 1;
}
if ($domain->entitlement) {
$this->error("Domain already assigned to a wallet: {$domain->entitlement->wallet->id}.");
return 1;
}
$sku = Sku::where('title', 'domain-hosting')->first();
Queue::fake(); // ignore LDAP for now (note: adding entitlements updates the domain)
Entitlement::create(
[
'wallet_id' => $wallet->id,
'sku_id' => $sku->id,
'cost' => 0,
'fee' => 0,
'entitleable_id' => $domain->id,
'entitleable_type' => Domain::class,
]
);
}
}

File Metadata

Mime Type
text/x-php
Expires
Mon, Sep 7, 10:01 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1355561
Default Alt Text
DomainSetWallet.php (1 KB)

Event Timeline