diff --git a/app/Http/Requests/AnswerFormRequest.php b/app/Http/Requests/AnswerFormRequest.php
index 2a3039f..73e6df6 100644
--- a/app/Http/Requests/AnswerFormRequest.php
+++ b/app/Http/Requests/AnswerFormRequest.php
@@ -60,7 +60,7 @@ class AnswerFormRequest extends FormRequest
if(isset($data[$field['id']]) && is_array($data[$field['id']])){
$data[$field['id']] = array_map(function ($val) use ($field) {
$tmpop = collect($field[$field['type']]['options'])->first(function ($op) use ($val) {
- return ($op['id'] === $val);
+ return ($op['id'] ?? $op['value'] === $val);
});
return isset($tmpop['name']) ? $tmpop['name'] : "";
}, $data[$field['id']]);
diff --git a/app/Http/Requests/UserFormRequest.php b/app/Http/Requests/UserFormRequest.php
index 81b0da7..d766305 100644
--- a/app/Http/Requests/UserFormRequest.php
+++ b/app/Http/Requests/UserFormRequest.php
@@ -126,7 +126,7 @@ abstract class UserFormRequest extends \Illuminate\Foundation\Http\FormRequest
// Custom SEO
'seo_meta' => 'nullable|array',
- 'custom_domain' => 'sometimes|nullable|regex:/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}$/'
+ 'custom_domain' => 'sometimes|nullable|regex:/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,20}$/'
];
}
diff --git a/app/Http/Requests/Workspace/CustomDomainRequest.php b/app/Http/Requests/Workspace/CustomDomainRequest.php
index 82a3e66..dd4640e 100644
--- a/app/Http/Requests/Workspace/CustomDomainRequest.php
+++ b/app/Http/Requests/Workspace/CustomDomainRequest.php
@@ -32,7 +32,7 @@ class CustomDomainRequest extends FormRequest
$domains = collect($value)->filter(function ($domain) {
return !empty( trim($domain) );
})->each(function($domain) use (&$errors) {
- if (!preg_match('/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}$/', $domain)) {
+ if (!preg_match('/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,20}$/', $domain)) {
$errors[] = 'Invalid domain: ' . $domain;
}
});
diff --git a/app/Http/Resources/FormResource.php b/app/Http/Resources/FormResource.php
index 34c04b1..85f11c2 100644
--- a/app/Http/Resources/FormResource.php
+++ b/app/Http/Resources/FormResource.php
@@ -50,7 +50,8 @@ class FormResource extends JsonResource
'notification_settings' => $this->notification_settings,
'removed_properties' => $this->removed_properties,
'last_edited_human' => $this->updated_at?->diffForHumans(),
- 'seo_meta' => $this->seo_meta
+ 'seo_meta' => $this->seo_meta,
+ 'max_file_size' => $this->max_file_size / 1000000,
] : [];
$baseData = $this->getFilteredFormData(parent::toArray($request), $this->userIsFormOwner());
diff --git a/app/Models/Forms/Form.php b/app/Models/Forms/Form.php
index 3fbf021..aaf280f 100644
--- a/app/Models/Forms/Form.php
+++ b/app/Models/Forms/Form.php
@@ -133,6 +133,7 @@ class Form extends Model implements CachableAttributes
protected $cachableAttributes = [
'is_pro',
'views_count',
+ 'max_file_size'
];
/**
@@ -234,6 +235,13 @@ class Form extends Model implements CachableAttributes
return !empty($this->password);
}
+ public function getMaxFileSizeAttribute()
+ {
+ return $this->remember('max_file_size', 15 * 60, function(): int {
+ return $this->workspace->max_file_size;
+ });
+ }
+
protected function removedProperties(): Attribute
{
return Attribute::make(
diff --git a/app/Models/Workspace.php b/app/Models/Workspace.php
index 6543dc9..367602a 100644
--- a/app/Models/Workspace.php
+++ b/app/Models/Workspace.php
@@ -14,9 +14,7 @@ class Workspace extends Model implements CachableAttributes
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',
diff --git a/resources/js/components/open/forms/OpenFormField.vue b/resources/js/components/open/forms/OpenFormField.vue
index ab6a44c..a85f8e5 100644
--- a/resources/js/components/open/forms/OpenFormField.vue
+++ b/resources/js/components/open/forms/OpenFormField.vue
@@ -51,7 +51,7 @@