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\UuidIntKeyTrait; | use App\Traits\UuidIntKeyTrait; | ||||
use App\Traits\BelongsToTenantTrait; | |||||
use App\Traits\DomainConfigTrait; | use App\Traits\DomainConfigTrait; | ||||
use App\Traits\SettingsTrait; | 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 | ||||
* @property int $status | * @property int $status | ||||
* @property int $tenant_id | * @property int $tenant_id | ||||
* @property int $type | * @property int $type | ||||
*/ | */ | ||||
class Domain extends Model | class Domain extends Model | ||||
{ | { | ||||
use UuidIntKeyTrait; | use UuidIntKeyTrait; | ||||
use BelongsToTenantTrait; | |||||
use DomainConfigTrait; | use DomainConfigTrait; | ||||
use SettingsTrait; | 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; | ||||
▲ Show 20 Lines • Show All 357 Lines • ▼ Show 20 Lines | public function suspend(): void | ||||
return; | return; | ||||
} | } | ||||
$this->status |= Domain::STATUS_SUSPENDED; | $this->status |= Domain::STATUS_SUSPENDED; | ||||
$this->save(); | $this->save(); | ||||
} | } | ||||
/** | /** | ||||
* The tenant for this domain. | |||||
* | |||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | |||||
*/ | |||||
public function tenant() | |||||
{ | |||||
return $this->belongsTo('App\Tenant', 'tenant_id', 'id'); | |||||
} | |||||
/** | |||||
* Unsuspend this domain. | * Unsuspend this domain. | ||||
* | * | ||||
* The domain is unsuspended through either of the following courses of actions; | * The domain is unsuspended through either of the following courses of actions; | ||||
* | * | ||||
* * The account balance has been topped up, or | * * The account balance has been topped up, or | ||||
* * a suspected spammer has resolved their issues, or | * * a suspected spammer has resolved their issues, or | ||||
* * the command-line is triggered. | * * the command-line is triggered. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines |