Changeset View
Changeset View
Standalone View
Standalone View
src/app/Domain.php
<?php | <?php | ||||
namespace App; | namespace App; | ||||
use App\Wallet; | use App\Wallet; | ||||
use App\Traits\DomainConfigTrait; | |||||
use App\Traits\SettingsTrait; | |||||
use Illuminate\Database\Eloquent\Model; | use Illuminate\Database\Eloquent\Model; | ||||
use Illuminate\Database\Eloquent\SoftDeletes; | use Illuminate\Database\Eloquent\SoftDeletes; | ||||
/** | /** | ||||
* The eloquent definition of a Domain. | * The eloquent definition of a Domain. | ||||
* | * | ||||
* @property string $namespace | * @property string $namespace | ||||
*/ | */ | ||||
class Domain extends Model | class Domain extends Model | ||||
{ | { | ||||
use DomainConfigTrait; | |||||
use SettingsTrait; | |||||
use SoftDeletes; | use SoftDeletes; | ||||
// we've simply never heard of this domain | // we've simply never heard of this domain | ||||
public const STATUS_NEW = 1 << 0; | public const STATUS_NEW = 1 << 0; | ||||
// it's been activated | // it's been activated | ||||
public const STATUS_ACTIVE = 1 << 1; | public const STATUS_ACTIVE = 1 << 1; | ||||
// domain has been suspended. | // domain has been suspended. | ||||
public const STATUS_SUSPENDED = 1 << 2; | public const STATUS_SUSPENDED = 1 << 2; | ||||
▲ Show 20 Lines • Show All 333 Lines • ▼ Show 20 Lines | public function hash($mod = null): string | ||||
} | } | ||||
$hash = \md5('hkccp-verify-' . $this->namespace); | $hash = \md5('hkccp-verify-' . $this->namespace); | ||||
return $mod === self::HASH_TEXT ? "$cname=$hash" : $hash; | return $mod === self::HASH_TEXT ? "$cname=$hash" : $hash; | ||||
} | } | ||||
/** | /** | ||||
* Any (additional) properties of this domain. | |||||
* | |||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany | |||||
*/ | |||||
public function settings() | |||||
{ | |||||
return $this->hasMany('App\DomainSetting', 'domain_id'); | |||||
} | |||||
/** | |||||
* Suspend this domain. | * Suspend this domain. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function suspend(): void | public function suspend(): void | ||||
{ | { | ||||
if ($this->isSuspended()) { | if ($this->isSuspended()) { | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |