diff --git a/app/Models/Applications/Application.php b/app/Models/Applications/Application.php index da20988..0abf05c 100644 --- a/app/Models/Applications/Application.php +++ b/app/Models/Applications/Application.php @@ -26,7 +26,9 @@ class Application extends Model { 'product_id', 'status', 'number', - 'applicant' + 'applicant', + 'email', + 'phone', ]; protected $hidden = [ diff --git a/app/Services/Forms/Applications/ApplicationForms.php b/app/Services/Forms/Applications/ApplicationForms.php index 80a7b0d..dbee93b 100644 --- a/app/Services/Forms/Applications/ApplicationForms.php +++ b/app/Services/Forms/Applications/ApplicationForms.php @@ -49,6 +49,20 @@ class ApplicationForms extends FormsService { 'required' => true, 'value' => $model->applicant ?? null ], + [ + 'name' => 'email', + 'title' => 'Email', + 'type' => FieldType::STRING, + 'required' => true, + 'value' => $model->phone ?? null + ], + [ + 'name' => 'phone', + 'title' => 'Телефон', + 'type' => FieldType::STRING, + 'required' => true, + 'value' => $model->phone ?? null + ], [ 'name' => 'product_name', 'title' => 'Hаименование продукции', @@ -70,12 +84,6 @@ class ApplicationForms extends FormsService { 'required' => true, 'value' => $model->product->usage ?? null ], - [ - 'name' => 'normative', - 'title' => 'Нормативно-технический документ', - 'type' => FieldType::STRING, - 'value' => $model->product->normative ?? null - ], [ 'name' => 'producer', 'title' => 'Изготовитель/разработчик', @@ -117,7 +125,11 @@ class ApplicationForms extends FormsService { } public function updateData(Application $model, array $data) { - $model->update(['applicant' => $data['applicant'] ?? null]); + $model->update([ + 'applicant' => $data['applicant'] ?? null, + 'email' => $data['email'] ?? null, + 'phone' => $data['phone'] ?? null + ]); $model->product->update(['name' => $data['product_name'] ?? null, 'purpose' => $data['product_purpose'] ?? null, 'usage' => $data['product_usage'] ?? null, 'normative' => $data['normative'] ?? null, 'producer' => $data['producer'] ?? null]); $model->properties->setValue('documents', $data['documents'] ?? null); diff --git a/app/Transformers/Applications/ApplicationTransformer.php b/app/Transformers/Applications/ApplicationTransformer.php index bc56de5..43c4693 100644 --- a/app/Transformers/Applications/ApplicationTransformer.php +++ b/app/Transformers/Applications/ApplicationTransformer.php @@ -26,6 +26,8 @@ class ApplicationTransformer extends TransformerAbstract { 'status' => $model->parsedStatus, 'number' => $model->number, 'applicant' => $model->applicant, + 'email' => $model->email, + 'phone' => $model->phone, 'created_at' => $model->created_at ? $model->created_at->toIso8601String() : null, 'updated_at' => $model->updated_at ? $model->updated_at->toIso8601String() : null ]; diff --git a/database/migrations/2023_09_07_135844_add_in_applications_table.php b/database/migrations/2023_09_07_135844_add_in_applications_table.php new file mode 100644 index 0000000..5f1d250 --- /dev/null +++ b/database/migrations/2023_09_07_135844_add_in_applications_table.php @@ -0,0 +1,33 @@ +string('email')->index()->nullable()->after('applicant'); + $table->string('phone')->index()->nullable()->after('email'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('applications', function (Blueprint $table) { + $table->dropColumn(['email', 'phone']); + }); + } +}