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: | * |
20: | * @property int $Id Object primary key |
21: | * @property int $IdChannel ID of the channel this tenant belongs to |
22: | * @property bool $IsDisabled If set, the tenant is disabled |
23: | * @property bool $IsDefault If set, it's a default tenant |
24: | * @property string $Name Tenant name |
25: | * @property string $Description Tenant description |
26: | * @property string $WebDomain Tenant web domain setting |
27: | * @property int $UserCountLimit @Deprecated since 9.7.0 |
28: | * @property string $Capa @Deprecated since 9.7.0 |
29: | * @property bool $AllowChangeAdminEmail @Deprecated since 9.7.0 |
30: | * @property bool $AllowChangeAdminPassword @Deprecated since 9.7.0 |
31: | * @property int $Expared @Deprecated since 9.7.0 |
32: | * @property string $PayUrl @Deprecated since 9.7.0 |
33: | * @property bool $IsTrial @Deprecated since 9.7.0 |
34: | * @property string $LogoUrl @Deprecated since 9.7.0 |
35: | * @property string $CalendarNotificationEmailAccount @Deprecated since 9.7.0 |
36: | * @property string $InviteNotificationEmailAccount @Deprecated since 9.7.0 |
37: | * @property array $Properties Custom properties for use by other modules |
38: | */ |
39: | class Tenant extends Model |
40: | { |
41: | protected $table = 'core_tenants'; |
42: | protected $moduleName = 'Core'; |
43: | |
44: | protected $foreignModel = Channel::class; |
45: | protected $foreignModelIdColumn = 'IdChannel'; // Column that refers to an external table |
46: | |
47: | protected $parentType = \Aurora\System\Module\Settings::class; |
48: | |
49: | protected $parentInheritedAttributes = [ |
50: | 'Files::UserSpaceLimitMb' |
51: | ]; |
52: | |
53: | /** |
54: | * The attributes that are mass assignable. |
55: | * |
56: | * @var array |
57: | */ |
58: | protected $fillable = [ |
59: | 'Id', |
60: | 'IdChannel', |
61: | 'IsDisabled', |
62: | 'IsDefault', |
63: | 'Name', |
64: | 'Description', |
65: | 'WebDomain', |
66: | 'UserCountLimit', |
67: | 'Capa', |
68: | 'AllowChangeAdminEmail', |
69: | 'AllowChangeAdminPassword', |
70: | 'Expared', |
71: | 'PayUrl', |
72: | 'IsTrial', |
73: | 'LogoUrl', |
74: | 'CalendarNotificationEmailAccount', |
75: | 'InviteNotificationEmailAccount', |
76: | 'Properties' |
77: | ]; |
78: | |
79: | /** |
80: | * The attributes that should be hidden for arrays. |
81: | * |
82: | * @var array |
83: | */ |
84: | protected $hidden = [ |
85: | ]; |
86: | |
87: | protected $casts = [ |
88: | 'Properties' => 'array', |
89: | |
90: | 'IsDisabled' => 'boolean', |
91: | 'IsDefault' => 'boolean', |
92: | 'AllowChangeAdminEmail' => 'boolean', |
93: | 'AllowChangeAdminPassword' => 'boolean', |
94: | 'IsTrial' => 'boolean' |
95: | ]; |
96: | |
97: | protected $attributes = [ |
98: | ]; |
99: | |
100: | protected $appends = [ |
101: | 'EntityId' |
102: | ]; |
103: | |
104: | /** |
105: | * Returns tenant ID |
106: | * |
107: | * return int |
108: | */ |
109: | public function getEntityIdAttribute() |
110: | { |
111: | return $this->Id; |
112: | } |
113: | } |
114: |