Skip to content

Beautiful Open-Source Form Builder

Various bug fixes

Julien Nahumebedaaf796fc
diff --git a/app/Http/Requests/AiGenerateFormRequest.php b/app/Http/Requests/AiGenerateFormRequest.php
index 6aac73580..eeac72429 100644
--- a/app/Http/Requests/AiGenerateFormRequest.php
+++ b/app/Http/Requests/AiGenerateFormRequest.php
@@ -14,7 +14,7 @@ class AiGenerateFormRequest extends FormRequest
public function rules()
{
return [
- 'form_prompt' => 'required|string'
+ 'form_prompt' => 'required|string|max:1000'
];
}
}
diff --git a/app/Jobs/Form/GenerateAiForm.php b/app/Jobs/Form/GenerateAiForm.php
index 04d595c52..3e19a3e20 100644
--- a/app/Jobs/Form/GenerateAiForm.php
+++ b/app/Jobs/Form/GenerateAiForm.php
@@ -55,7 +55,7 @@ class GenerateAiForm implements ShouldQueue
} catch (\Exception $e) {
$this->completion->update([
'status' => AiFormCompletion::STATUS_FAILED,
- 'result' => $e->getMessage()
+ 'result' => ['error' => $e->getMessage()]
]);
}
diff --git a/app/Models/Forms/Form.php b/app/Models/Forms/Form.php
index c932e9a60..bf52c0939 100644
--- a/app/Models/Forms/Form.php
+++ b/app/Models/Forms/Form.php
@@ -218,6 +218,11 @@ class Form extends Model
return !empty($this->password);
}
+ public function getRemovedPropertiesAttribute()
+ {
+ return $this->attributes['removed_properties'] ?? [];
+ }
+
/**
* Relationships
*/
diff --git a/database/migrations/2023_10_13_080104_change_type_of_form_prompt_in_ai_form_completions.php b/database/migrations/2023_10_13_080104_change_type_of_form_prompt_in_ai_form_completions.php
new file mode 100644
index 000000000..5d847655e
--- /dev/null
+++ b/database/migrations/2023_10_13_080104_change_type_of_form_prompt_in_ai_form_completions.php
@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('ai_form_completions', function (Blueprint $table) {
+ $table->text('form_prompt')->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('ai_form_completions', function (Blueprint $table) {
+ $table->string('form_prompt')->change();
+ });
+ }
+};