Adding Custom domains (#247)
* WIP * wip * Finished doing most of the work
This commit is contained in:
@@ -14,10 +14,13 @@ class Workspace extends Model
|
||||
const MAX_FILE_SIZE_FREE = 5000000; // 5 MB
|
||||
const MAX_FILE_SIZE_PRO = 50000000; // 50 MB
|
||||
|
||||
const MAX_DOMAIN_PRO = 1;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'icon',
|
||||
'user_id',
|
||||
'custom_domain',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
@@ -25,6 +28,10 @@ class Workspace extends Model
|
||||
'is_enterprise'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'custom_domains' => 'array',
|
||||
];
|
||||
|
||||
public function getIsProAttribute()
|
||||
{
|
||||
if(is_null(config('cashier.key'))){
|
||||
@@ -60,6 +67,26 @@ class Workspace extends Model
|
||||
return self::MAX_FILE_SIZE_FREE;
|
||||
}
|
||||
|
||||
public function getCustomDomainCountLimitAttribute()
|
||||
{
|
||||
if(is_null(config('cashier.key'))){
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return max file size depending on subscription
|
||||
foreach ($this->owners as $owner) {
|
||||
if ($owner->is_subscribed) {
|
||||
if ($license = $owner->activeLicense()) {
|
||||
// In case of special License
|
||||
return $license->custom_domain_limit_count;
|
||||
}
|
||||
}
|
||||
return self::MAX_DOMAIN_PRO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getIsEnterpriseAttribute()
|
||||
{
|
||||
if(is_null(config('cashier.key'))){
|
||||
|
||||
Reference in New Issue
Block a user