1: | <?php |
2: | /** |
3: | * This code is licensed under AGPLv3 license or Afterlogic Software License |
4: | * if commercial version of the product was purchased. |
5: | * For full statements of the licenses see LICENSE-AFTERLOGIC and LICENSE-AGPL3 files. |
6: | */ |
7: | |
8: | namespace Aurora\Modules\Core\Models; |
9: | |
10: | use Aurora\System\Classes\Model; |
11: | use Aurora\Modules\Core\Models\Channel; |
12: | |
13: | /** |
14: | * The Core Tenant class. |
15: | * |
16: | * @license https://www.gnu.org/licenses/agpl-3.0.html AGPL-3.0 |
17: | * @license https://afterlogic.com/products/common-licensing Afterlogic Software License |
18: | * @copyright Copyright (c) 2023, Afterlogic Corp. |
19: | * @property int $Id Object primary key |
20: | * @property int $IdChannel ID of the channel this tenant belongs to |
21: | * @property bool $IsDisabled If set, the tenant is disabled |
22: | * @property bool $IsDefault If set, it's a default tenant |
23: | * @property string $Name Tenant name |
24: | * @property string $Description Tenant description |
25: | * @property string $WebDomain Tenant web domain setting |
26: | * @property int $UserCountLimit @Deprecated since 9.7.0 |
27: | * @property string $Capa @Deprecated since 9.7.0 |
28: | * @property bool $AllowChangeAdminEmail @Deprecated since 9.7.0 |
29: | * @property bool $AllowChangeAdminPassword @Deprecated since 9.7.0 |
30: | * @property int $Expared @Deprecated since 9.7.0 |
31: | * @property string $PayUrl @Deprecated since 9.7.0 |
32: | * @property bool $IsTrial @Deprecated since 9.7.0 |
33: | * @property string $LogoUrl @Deprecated since 9.7.0 |
34: | * @property string $CalendarNotificationEmailAccount @Deprecated since 9.7.0 |
35: | * @property string $InviteNotificationEmailAccount @Deprecated since 9.7.0 |
36: | * @property array $Properties Custom properties for use by other modules |
37: | * @property \Illuminate\Support\Carbon|null $CreatedAt |
38: | * @property \Illuminate\Support\Carbon|null $UpdatedAt |
39: | * @property-read mixed $entity_id |
40: | * @method static \Illuminate\Database\Eloquent\Builder|\Aurora\Modules\Core\Models\Tenant firstWhere(Closure|string|array|\Illuminate\Database\Query\Expression $column, mixed $operator = null, mixed $value = null, string $boolean = 'and') |
41: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant newModelQuery() |
42: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant newQuery() |
43: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant query() |
44: | * @method static \Illuminate\Database\Eloquent\Builder|\Aurora\Modules\Core\Models\Tenant where(Closure|string|array|\Illuminate\Database\Query\Expression $column, mixed $operator = null, mixed $value = null, string $boolean = 'and') |
45: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereAllowChangeAdminEmail($value) |
46: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereAllowChangeAdminPassword($value) |
47: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereCalendarNotificationEmailAccount($value) |
48: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereCapa($value) |
49: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereCreatedAt($value) |
50: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereDescription($value) |
51: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereExpared($value) |
52: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereId($value) |
53: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereIdChannel($value) |
54: | * @method static \Illuminate\Database\Eloquent\Builder|\Aurora\Modules\Core\Models\Tenant whereIn(string $column, mixed $values, string $boolean = 'and', bool $not = false) |
55: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereInviteNotificationEmailAccount($value) |
56: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereIsDefault($value) |
57: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereIsDisabled($value) |
58: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereIsTrial($value) |
59: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereLogoUrl($value) |
60: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereName($value) |
61: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant wherePayUrl($value) |
62: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereProperties($value) |
63: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereUpdatedAt($value) |
64: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereUserCountLimit($value) |
65: | * @method static \Illuminate\Database\Eloquent\Builder|Tenant whereWebDomain($value) |
66: | * @method static \Illuminate\Database\Eloquent\Builder|\Aurora\Modules\Core\Models\Tenant find(int|string $id, array|string $columns = ['*']) |
67: | * @method static int count(string $columns = '*') |
68: | * @method static \Illuminate\Database\Eloquent\Builder|\Aurora\Modules\Core\Models\Tenant findOrFail(int|string $id, mixed $id, Closure|array|string $columns = ['*'], Closure $callback = null) |
69: | * @method static \Illuminate\Database\Eloquent\Builder|\Aurora\Modules\Core\Models\Tenant first(array|string $columns = ['*']) |
70: | * @mixin \Eloquent |
71: | */ |
72: | class Tenant extends Model |
73: | { |
74: | protected $table = 'core_tenants'; |
75: | protected $moduleName = 'Core'; |
76: | |
77: | protected $foreignModel = Channel::class; |
78: | protected $foreignModelIdColumn = 'IdChannel'; // Column that refers to an external table |
79: | |
80: | protected $parentType = \Aurora\System\Module\Settings::class; |
81: | |
82: | protected $parentInheritedAttributes = [ |
83: | 'Files::UserSpaceLimitMb' |
84: | ]; |
85: | |
86: | /** |
87: | * The attributes that are mass assignable. |
88: | * |
89: | * @var array |
90: | */ |
91: | protected $fillable = [ |
92: | 'Id', |
93: | 'IdChannel', |
94: | 'IsDisabled', |
95: | 'IsDefault', |
96: | 'Name', |
97: | 'Description', |
98: | 'WebDomain', |
99: | 'UserCountLimit', |
100: | 'Capa', |
101: | 'AllowChangeAdminEmail', |
102: | 'AllowChangeAdminPassword', |
103: | 'Expared', |
104: | 'PayUrl', |
105: | 'IsTrial', |
106: | 'LogoUrl', |
107: | 'CalendarNotificationEmailAccount', |
108: | 'InviteNotificationEmailAccount', |
109: | 'Properties' |
110: | ]; |
111: | |
112: | /** |
113: | * The attributes that should be hidden for arrays. |
114: | * |
115: | * @var array |
116: | */ |
117: | protected $hidden = [ |
118: | ]; |
119: | |
120: | protected $casts = [ |
121: | 'Properties' => 'array', |
122: | |
123: | 'IsDisabled' => 'boolean', |
124: | 'IsDefault' => 'boolean', |
125: | 'AllowChangeAdminEmail' => 'boolean', |
126: | 'AllowChangeAdminPassword' => 'boolean', |
127: | 'IsTrial' => 'boolean' |
128: | ]; |
129: | |
130: | protected $attributes = [ |
131: | ]; |
132: | |
133: | protected $appends = [ |
134: | 'EntityId' |
135: | ]; |
136: | |
137: | /** |
138: | * Returns tenant ID |
139: | * |
140: | * return int |
141: | */ |
142: | public function getEntityIdAttribute() |
143: | { |
144: | return $this->Id; |
145: | } |
146: | } |
147: |