Changeset View
Changeset View
Standalone View
Standalone View
src/app/User.php
<?php | <?php | ||||
namespace App; | namespace App; | ||||
use App\Entitlement; | use App\Entitlement; | ||||
use App\UserAlias; | use App\UserAlias; | ||||
use App\Sku; | use App\Sku; | ||||
use App\Traits\UuidIntKeyTrait; | use App\Traits\UuidIntKeyTrait; | ||||
use App\Traits\BelongsToTenantTrait; | |||||
use App\Traits\UserConfigTrait; | use App\Traits\UserConfigTrait; | ||||
use App\Traits\UserAliasesTrait; | use App\Traits\UserAliasesTrait; | ||||
use App\Traits\SettingsTrait; | use App\Traits\SettingsTrait; | ||||
use App\Wallet; | use App\Wallet; | ||||
use Illuminate\Database\Eloquent\SoftDeletes; | use Illuminate\Database\Eloquent\SoftDeletes; | ||||
use Illuminate\Support\Facades\Hash; | use Illuminate\Support\Facades\Hash; | ||||
use Illuminate\Foundation\Auth\User as Authenticatable; | use Illuminate\Foundation\Auth\User as Authenticatable; | ||||
use Iatstuti\Database\Support\NullableFields; | use Iatstuti\Database\Support\NullableFields; | ||||
use Laravel\Passport\HasApiTokens; | use Laravel\Passport\HasApiTokens; | ||||
use League\OAuth2\Server\Exception\OAuthServerException; | use League\OAuth2\Server\Exception\OAuthServerException; | ||||
/** | /** | ||||
* The eloquent definition of a User. | * The eloquent definition of a User. | ||||
* | * | ||||
* @property string $email | * @property string $email | ||||
* @property int $id | * @property int $id | ||||
* @property string $password | * @property string $password | ||||
* @property int $status | * @property int $status | ||||
* @property int $tenant_id | * @property int $tenant_id | ||||
*/ | */ | ||||
class User extends Authenticatable | class User extends Authenticatable | ||||
{ | { | ||||
use UuidIntKeyTrait; | use UuidIntKeyTrait; | ||||
use BelongsToTenantTrait; | |||||
use NullableFields; | use NullableFields; | ||||
use UserConfigTrait; | use UserConfigTrait; | ||||
use UserAliasesTrait; | use UserAliasesTrait; | ||||
use SettingsTrait; | use SettingsTrait; | ||||
use SoftDeletes; | use SoftDeletes; | ||||
use HasApiTokens; | use HasApiTokens; | ||||
// a new user, default on creation | // a new user, default on creation | ||||
▲ Show 20 Lines • Show All 602 Lines • ▼ Show 20 Lines | public function suspend(): void | ||||
return; | return; | ||||
} | } | ||||
$this->status |= User::STATUS_SUSPENDED; | $this->status |= User::STATUS_SUSPENDED; | ||||
$this->save(); | $this->save(); | ||||
} | } | ||||
/** | /** | ||||
* The tenant for this user account. | |||||
* | |||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | |||||
*/ | |||||
public function tenant() | |||||
{ | |||||
return $this->belongsTo('App\Tenant', 'tenant_id', 'id'); | |||||
} | |||||
/** | |||||
* Unsuspend this domain. | * Unsuspend this domain. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function unsuspend(): void | public function unsuspend(): void | ||||
{ | { | ||||
if (!$this->isSuspended()) { | if (!$this->isSuspended()) { | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 243 Lines • Show Last 20 Lines |